Read-Only Attachments on Editable View

301
2
03-31-2023 11:53 PM
MobiusSnake
MVP

Hi, I've got an editable hosted feature layer view that I'm trying to restrict editing on to a handful of very specific scenarios.  Disabling editing on specific fields gets me part way, but I'd like to do something similar for attachments - make it so the users can view attachments, but they can't add new attachments nor can they delete existing attachments.  Anyone know if this is possible?  I'm assuming it isn't via the UI but wondering if there's a REST API call I can make.  I'd prefer to restrict access the view level rather than the application level, e.g. S123.

Tags (2)
0 Kudos
2 Replies
Omar_A
by Esri Contributor
Esri Contributor

Hi,

You can set the "HasAttachments" Property to "false" to disable the ability to add new attachments. You can also set the "capabilities" property to "Query" to allow users to view existing attachments but not delete them.

Here is an example of JSON code, that disables adding new attachments while allowing users to view existing attachments:

https://services.arcgis.com/{yourOrgID}/arcgis/rest/admin/services/{yourServiceName}/FeatureServer/0...

In the request body, include 

{
"capabilities": "Query",
"hasAttachments": false
}

 

Best,

Omar

 

MobiusSnake
MVP

Thanks!  I'll give that a spin today and see how it goes.

Edit - Update on this, unfortunately it seems to prevent the view's users from viewing attachments altogether, not just adding or removing attachments.