4

I cannot find this information anywhere on ArcGIS official documentation, but if a feature that contains attachments is deleted, will the attachments be deleted as well? Or will they be left orphaned?

Or simply put, when I call REST API to delete a feature and I don't want orphaned attachments occupying server space, do I need to delete the attachments first before deleting the feature itself?

3
  • Documentation is great, but results speak for themselves. Have you tested? If so, what are you seeing?
    – bixb0012
    May 12, 2022 at 15:14
  • I've seen mixed results. First try on a simple service, one feature, one attachment; deleted and the attachment size went to zero. The next day, the attachment size went back up to 4 MB when nothing else had changed. The feature is gone in the service, a downloaded geodatabase contains no attachments. Seems like it works, but why did the attachment size increase?
    – Ian Yau
    May 12, 2022 at 20:07
  • attachments seem to use a relationship classe , relationship can have different strength (simple or composite) that determine if a child is deleted or not when the parent is deleted so it seem possible that the answer to your question is "it depend on your attachment properties". (I don't use attachments so I may be wrong on that)
    – J.R
    Feb 17 at 11:38

1 Answer 1

0

Yes, deleting a service enabled with attachment will delete the associated attachments.

As a best practice you can follow the Truncate request to only remove attachments first if set as True or delete entirely.

Follow the below URL for better understanding:

https://developers.arcgis.com/rest/services-reference/online/truncate-feature-layer-.htm

1
  • The question is about deleting a feature, not the entire service.
    – Ian Yau
    May 9, 2022 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.