Export Privileges Confusion

11-18-2020 12:13 PM
Occasional Contributor III

I'm trying to figure out why I can't export data from my group.  According to export tool documentation, you either need to own the service or be an administrator; I am an administrator for our organization (role = org_admin when I print it in python): https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.export

What am I misunderstanding here? When I run this code, I get an error that says "You do not have permissions to access this resource or perform this operation"

    gis = GIS("https://www.arcgis.com", username="xxx", password="xxx")
    myRole = gis.users.me.role #org_admin
    gID = gis.groups.search('title: "NBCI Maps"')[0].id
    grp = Group(gis, gID)
    content = grp.content()
    for item in content:
        if "Markup" in item.title:
            markup = item
    hm = markup.export('test', 'File Geodatabase')


The user who has published a markup layer (feature collection) to the group is also a member of our organization. If I go on arcgis online on desktop and log in with my administrator account, I have the capability via the "Analysis > Manage Data > Export Data" function in the web map to export the same data I'm trying to access with python (owned by a different user). There should be no reason I can't do it in Python from what I can tell. Would love some insight on this.

3 Replies
MVP Honored Contributor

I am suddenly getting this on a script that worked before as well. 

I tracked it down to that you can now only export Items you own.  When did this start?  Is this some sort of bug?  I am in the group, export is on, I am even the group manager.  It all works fine when I am the owner.

Also I can manually export the item using the AGOL interface manually.  So it must be a API issue.

result = fsLink.export("tempOut"+ HFSname, "File Geodatabase")


result = fsLink.export("tempOut"+ HFSname, "File Geodatabase", "overwrite=True")
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 7333, in export
res = self._portal.con.post(data_path, params)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\connection.py", line 1183, in post
self._handle_json_error(resp_json['error'], errorcode)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\connection.py", line 1204, in _handle_json_error
raise RuntimeError(errormessage)
RuntimeError: You do not have permissions to access this resource or perform this operation.
(Error Code: 403)


0 Kudos
Occasional Contributor III

Whoops, I should have updated this!

I realize you said you were using this script before and it just stopped working so my answer may not apply, but I found out for my purpose I was using the wrong tool altogether. I was trying to use the export function instead of the extract data function. When I used the extract data function instead, it worked how I wanted it too. If I recall right, if I have an Administrator role in my organization (not just a group manager/owner), I could extract anybody’s data in the group as long as the user was part of our organization. If the user is outside the organization, you will be unable to extract their data.

To me the documentation is rather unclear about how export and extract data differ. From what I can gather in the documentation, it sounds like export is for exporting an entire service and extract data is for querying and exporting only certain features (or all the features if you so choose).

If you find that export is what you need, you need to be the owner of the service (which you said works), but you need have an Administrator role in your organization to export anything owned by anyone else in the group, not just the owner/manager of the group, as per the documentation. If you're trying to export a service that's owned by a group member that is not within your organization, you will be unable to do so, just like the extract data tool.

0 Kudos
MVP Honored Contributor

I submitted a ticket and it is a known bug.  Need to be admin or owner.

This is Vivien from Esri Support Services. I've taken ownership of your case, where you're having some issues with a python script that no longer works. Specifically, you're getting error, "You do not have permissions to access this resource or perform this operation.
(Error Code: 403)". 

I did a little bit of research on this, and it seems consistent with BUG-000129641. Its synopsis states, "The ArcGIS Online user with custom roles is unable to export items from ArcGIS API for Python via ArcGIS Pro 2.5 as in ArcGIS Pro 2.3". However, our testing indicates that this behavior is not specific to users with custom roles; it occurs with all users trying to export data they are not the owner of or do not have full admin permissions in their organization. Similarly, it is reproducible in versions ArcGIS Pro 2.4-2.7. Its status is marked as "In Product Plan", and the workaround is to grant full admin permissions or change ownership of the item.

We apologize for the inconvenience and thank you for bringing it to our attention. I'll leave the case open for one additional business day (Wednesday, February 24 at 4 PM PT) for you to review. Feel free to reach out if you have any questions or concerns at 888-377-4575 and refer to your case #, or you can reply directly to this email. Thanks, and stay healthy and safe


0 Kudos