How do you save blobs using Pro SDK in CoreHost?

965
7
09-18-2020 04:23 PM
SungBae
New Contributor

Environment/Project

  • ArcGIS Pro 2.6
  • .NET Framework 4.8 Console Application (CoreHost)

I can't save an image as a blob into my non-versioned table hosted as a feature service. However, I am able to save successfully if I'm pointing to a file geodatabase instead of a feature service.

Could someone advise on how to properly save blobs when referencing a feature service?

Please see the attached PDF for screenshots of example code.

0 Kudos
7 Replies
RichRuh
Esri Regular Contributor

Hi Sung,

Your code looks fine.  We'll take a look at this one alongside the annotation editing issue you already reported (we haven't reached any conclusions yet).

Thanks,

--Rich

0 Kudos
SungBae
New Contributor

Hi Rich,

Sounds good, thanks for looking into it!

Best,

Sung

0 Kudos
RichRuh
Esri Regular Contributor

This is going to sound a little random, but what happens if you try to get the TableDefinition from the table using Table.GetDefinition()?  I'm talking about the table with the blob field that you are trying to update.

Also, are you able to update a feature class in the same non-versioned feature service that contains a blob field?

--Rich

0 Kudos
SungBae
New Contributor

Hi Rich,

It looks like I can get the table definition just fine. Please see the screenshots below. I still get the same error when trying to save blob field within a feature class, and I can save the row just fine if I simply skip the setting of the blob within the buffer.

Let me know if you need anything else.

Thanks,

Sung

0 Kudos
RichRuh
Esri Regular Contributor

Hi Sung,

We've finished our research about this issue.  Unfortunately, I determined that this is not an SDK issue after all.  It's a deeper issue- we don't support reading and writing blob fields from ArcGIS Server-based feature services.  (Technically this isn't true, but the only blob support is within annotation features; generic blob fields are not supported).  You cannot read or write blob fields with the Pro user interface, with Python, or with the Pro SDK.

Blob fields are supported in hosted feature services, in enterprise geodatabases, file geodatabases, and mobile geodatabases.

Sorry- this probably isn't the answer you wanted to hear.

--Rich

0 Kudos
SungBae
New Contributor

Hey Rich,

Thanks for looking into this!

As a work around, I've changed the blob fields as a text datatype to hold the base 64 string representation of the blob. Based on a few tests, it looks like I can read/write that string representation and encode it back to a blob. I assume this is the only possible way to work with generic blobs when using feature services?

I guess this will only work for tables that you have control over... Welp that's a bummer!

Sung

0 Kudos
RichRuh
Esri Regular Contributor

Hi Sung,

At this point that's probably the best workaround.  We'll add better feature service blob support in a future release.

--Rich

0 Kudos