arcgis-python-api icon indicating copy to clipboard operation
arcgis-python-api copied to clipboard

AttachmentManager.get_list() isn't returning correct attachments from a branch version

Open mhirschheimer opened this issue 6 months ago • 2 comments
trafficstars

Describe the bug AttachmentManager.get_list() isn't returning correct attachments from a branch version Even with the version parameter specified, the returned attachments is coming from the SDE.Default version.

To Reproduce Steps to reproduce the behavior:


from arcgis.gis import GIS
from arcgis.features._version import VersionManager
from arcgis.features.managers import AttachmentManager

portalUrl = "https://<server name>/portal/"
user = "unowner.electric"
pw = ""
unFeatureServiceURL = "https://<server name>/server/rest/services/Electric_UN/Electric_Utility_Network/FeatureServer"
versionMgmtServiceURL = unFeatureServiceURL.replace("FeatureServer", "VersionManagementServer" ) 

# Connect to your Enterprise Portal
gis = GIS(url=portalUrl, username=user, password=pw, verify_cert=True)
token = gis._con.token 

vms = VersionManager(url = versionMgmtServiceURL, gis= gis)
version = vms.get("unowner.electric.AttachmentEditing_20250418111109")
print(version.properties['versionName'])

featureOID = 126

for lyr in version.layers :
    if '910' in lyr.url :
        print("======================================================================================")
        print(f"ArcGIS Python API:  List Attachments for feature {featureOID} in version {version.properties['versionName']}")
        print("======================================================================================")
        attachmentManager = AttachmentManager(layer= lyr, version= version)
        existingAttachments = attachmentManager.get_list(oid= featureOID)  ##This is only finding Attachments in Default
        for existing in existingAttachments :
            print(f"  {existing} ")

error:

<copy the full error message here>
No error messages.  Just wrong result

**Screenshots**
see attachment
The REST Endpoint is returning the correct attachments.  The Python API isn't.

[AttachmentManager get_list expected results.docx](https://github.com/user-attachments/files/19850929/AttachmentManager.get_list.expected.results.docx)


**Expected behavior**
Attachments in the branch named versions are returned by the API

**Platform (please complete the following information):**
 - OS: [e.g. iOS]:  Windows 11
 - Browser [e.g. chrome, safari]  N/A
 - Python API Version [e.g. `1.6.2`] (you can get this by typing `print(arcgis.__version__)`
 - 2.4.0
 - Running python script in VS Code on a machine with ArcGIS Pro 3.4.3 installed

**Additional context**
I'm an Esri employee and can provide access to the Utility Network service that I'm seeing this behavior on.  Although I'm using a Utility Network service, I don't think the issue has anything todo with the Utility Network.

mhirschheimer avatar Apr 22 '25 13:04 mhirschheimer