Unable to Upload Attachments to a Layer

10-31-2018 04:09 AM
New Contributor

Hi, I try to add an attachment to a layer. 
Using the online Portal I am able to upload attachments successfully. But using the .NET Runtime SDK 100 this Operation Fails.

I am able to retrieve and delete existing attachments. But unable to upload an Attachment using the ArcGisFeature.AddAttachmentAsync, ServiceFeatureTable.UpdateFeatureAsync, ServiceFeatureTable.AppyEditsAsync functions.

The AddAttachmentAsync call always returns an Attachment with id -10 (second gets -11, -12 and so on)
I am able to retrieve, delete and update the attachments I have added to my feature as long as the application is running. After restarting these attachments have vanished.

The ApplyEditsAsync Always Returns an EditResult which completet with Errors and containing the Message "JSONObject["attachment"] not found."

Is there anything I am missing?

0 Kudos
4 Replies
Esri Contributor

What version of 100 x series of ArcGIS Runtime SDK .Net are you using . Where is the data hosted ArcGIS Online ( on an org) or on a premise Portal? If on premise, what is version the version of ArcGIS Portal? Is it a hosted feature service? Can you share link to the service ?

0 Kudos
New Contributor

Sorry for the late response, I didn't see it earlier.
We are using the latest 100.3  SDK the data and Service is hostet on premise. Server is 10.6.1   
Currently we can not share a Link to the Service

0 Kudos
Esri Contributor

I can try using the specific configuration combination that you have but I think in absence of any repro data/code it might be difficult to identify the problem. In the meantime I suggest checking the Hosted feature service's capabilities.

0 Kudos
New Contributor II

i continue the work of my colleague.

we still have this issue and i was able to limit the source of the error.

When we create and add a attachment with the SDK it uses the following workflow:

1. Upload the attachment by calling the ...FeatureServer/uploads/upload

2. After this was successfully finished 

3. Adding the attachment by calling  .../FeatureServer/0/1/addAttachment with the UploadID

Now we get the error JSONObject["attachment"] not found.

I can reproduce this, trying to add a attachment with the UploadId directly in the Browser.

The Server always expected the attachment upload.

Refering to the documentation Add Attachment—ArcGIS REST API: Services Directory | ArcGIS for Developers  the option supportsAttachmentsByUploadId is true.

As a workaround we tried to disable this option, to force the SDK uploading the file directly by calling .../FeatureServer/0/1/addAttachment instead of uploading it before.


For the "not hosted" MapServer we can't find the option.

The hosted MapServer/FeatureServer contains this option, but changing it to supportsAttachmentsByUploadId = false does not have an effekt anyway.

0 Kudos