Get User Folder Name Provided the Folder ID

07-09-2019 07:18 AM
Occasional Contributor III

Using the ArcGIS API for Python, is there a way to get the name of a user's folder if provided the folder ID?

For example, one of the properties of a portal item is "ownerFolder", which returns the id of the user's folder where the portal item is housed.  This is very helpful if the user has many folders when trying to find the item.  I'd like to know the name of this folder rather than just having the id.  Is there something similar to "content.get('item_id')" that can be used to return folder properties?

I'm aware of arcgis.gis.User("user_name").folders ... which returns a list of dictionaries providing information about all the folders a user has.  I don't really want to cross-reference all the user's folders and then match the id, but if that's the only way...

Tags (1)
0 Kudos
1 Reply
Occasional Contributor

Here's how I did  it:

gis = GIS(urlAGOL, userName, userPass)

gisUser = arcgis.gis.User(gis, "username of person who owns folder")
for fld in gisUser.folders:
    print(fld['id'], fld['title'])

0 Kudos