Select to view content in your preferred language

Incorrect Portal Attachment Count

734
1
01-21-2020 08:34 AM
CoreyLunty1
Occasional Contributor

Hello

I am having an issue where when I view data from a feature layer in ArcGIS Portal, attachments I have added to records in the feature layer via python do not appear to 'count' for the attachment count: The GUI will say there are zero 'Photos and Files' associated with the record, but when I click the 'Add' button, an existing attachment appears as expected.

If I go to 'Add' and add another attachment through the GUI, this attachment count will increase to '1', despite there now being 2 attachments. I remove my secondary attachment, and the count goes back down to zero.

Using the REST services, if I go to <feat server url>/1/OBJECTID/attachments. I see my one attachment:

This is the Python I am using (within an FME Workbench) to attach the attachments in bulk:

Basically I am using requests library to POST to <feat server url>/1/OBJECTID/addAttachment.

The token and f=json are specified in the url and so are not included in the requests.post() call.

import fme

import fmeobjects

import requests

def processFeature(feature):

    

    url = feature.getAttribute('addAttachmentURL')

    

    mime_type = feature.getAttribute('mime_type')

    

    filename = feature.getAttribute('_justfilename')

    filenamewithpath = feature.getAttribute('_filename')

    

    files = {'attachment': (filename, open(filenamewithpath,'rb'), mime_type, {})}

    

    r = requests.post(url, files=files)

    

    feature.setAttribute("result",r.text)

    

    pass

Is there something I must do after making the addAttachment call to increment the attachment count that Portal uses?

ArcGIS Server version 10.71

Tags (3)
0 Kudos
1 Reply
DelaereMickael
Frequent Contributor

hello,

I have got the same problem with portal 10.7.1. I asked for the support there is a bug referenced on 10.8 : BUG-000132192

https://support.esri.com/fr/bugs/nimbus/QlVHLTAwMDEzMjE5Mg==

0 Kudos