Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mhirschheimer opened this issue Apr 22, 2025 · 0 comments
Labels

Comments

@mhirschheimer
Copy link

mhirschheimer commented Apr 22, 2025

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant