How can I list folders on Portal?

358
4
Jump to solution
01-07-2022 04:39 PM
BrianWilson7
Regular Contributor

Today I trudged through the code to figure out how to list the folders that are in my Server, but I cannot see how to list them on Portal.  My assumption is to look in the ContentManager. I can see the methods "create_folder", "delete_folder", and "rename_folder".

Similar to the ServicesManager I'd anticipate a property like "contentmanager.folders" would be the list but nothing.

I figured out that I can see what folders a user owns with the "folders" property of a User object.

I found the PortalAdminManager object but it seems not usable for this either.

Where is the folders property for portal hiding?

 

0 Kudos
1 Solution

Accepted Solutions
BrianWilson7
Regular Contributor

Okay, I get it now. 

My collection of folders is only visible to me. When I sign on as a different user, the things that I have shared with the org are visible to them, but there is no indication to them that it's in a folder.

ACTUAL folders exist on the SERVER but not on the PORTAL, except as a fiction for the currently logged in user. If I tell someone to look in TESTING_Brian folder for a collection of services they will have no idea what I am talking about. Unless they look on SERVER. Then they will see folders named as I specified.

UNLESS (of course) it is a hosted feature class, in which case it will be in the "Hosted" folder no matter what you told it to do when you published it.

UNLESS it's a map image layer and you TOLD it to publish it in the "Hosted" folder, in which case it will not be there. It will be in the / (root) folder. 

Note also if you tell it to put things in folders on the Portal from Python, sometimes it ignores that too. You have to create the service and then move it. 

It won't tell you when it's ignoring your requests to put things in folders, they just won't be there.

UNLESS it's Monday after a three day weekend and you're publishing from ArcGIS Pro 2.9 in which case it probably just won't work at all.

HAHHAHAHAHA an alert box just randomly popped up on my screen that said "Tell us what you think"!!!!

What great timing. I believe that's what I am doing here.

This is the short answer to my question - So okay, I can list folders FOR A USER. Because they have no other meaning. I get it now. Moving on,

Cloning Content

I just ran across this "https://developers.arcgis.com/python/guide/cloning-content/" "Cloning Content" thing. I will check that out. I wish Esri had told me about it a few weeks ago but I've learned lots about the internals so I am not bothered by it.

I wonder if it even knows about Portal folders? I wonder if I will stop using them soon? Maybe tags or categories are better? I only started using them because I expected them to act like, well, "folders".

I wonder if it works when version numbers are not the same?

I wonder if I can test it without having access to both servers? 

So much wonder! And all before lunch!

 

View solution in original post

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

perhaps

arcgis.gis.admin.PortalAdminManager.system

This resource provides access to the ArcGIS Web Adaptor configuration, portal directories, database management server, indexing capabilities, license information, and the properties of your portal.


... sort of retired...
BrianWilson7
Regular Contributor

Thanks Dan, 

Accessing 'system' returns an undocumented "System" object. Prying it open in the debugger reveals it has properties including "directories". Those are the ones revealed in the REST interface at https://delta.co.clatsop.or.us/portal/portaladmin/system/directories and they are the locations of the index, db, temp, and content directories on the portal server. For example, the "content" property returns "C:/arcgisportal/content/" which is where content is stored but has nothing to do with the "folders" used in the Portal.

Here is a snippet of code demonstrating the system object.

import arcgis.gis
gis = arcgis.gis.GIS(Config.PORTAL_URL,
                     Config.PORTAL_USER,
                     Config.PORTAL_PASSWORD,
                     initialize=True) # <---- it needs this
portalManager = arcgis.gis.admin.PortalAdminManager(
    url=Config.PORTAL_URL + '/portaladmin', 
    gis=gis)
s = portalManager.system
print(s.directories)

 

The folders I am talking about are the ones that Portal users can create and store their content in.They are not real folders on the file system, they are just managed internally by Portal. For example, I can place a service in a folder called "TESTING_Brian" and then in the properties for that service in Portal I can see over in the right column "Folder" and it shows  TESTING_Brian.

If you look in the actual contents folder you will see each service has a folder named by its ID, and some other config files, but there won't be any TESTING_Brian folder. I think that's probably each "folder" is just a table entry in the PostgreSQL database that Portal uses internally. But that's off limits.

I am trying to copy all content from an instance of 10.8 to 10.9.1 quickly and with a minimum of pain.

 

0 Kudos
BrianWilson7
Regular Contributor

Okay, I get it now. 

My collection of folders is only visible to me. When I sign on as a different user, the things that I have shared with the org are visible to them, but there is no indication to them that it's in a folder.

ACTUAL folders exist on the SERVER but not on the PORTAL, except as a fiction for the currently logged in user. If I tell someone to look in TESTING_Brian folder for a collection of services they will have no idea what I am talking about. Unless they look on SERVER. Then they will see folders named as I specified.

UNLESS (of course) it is a hosted feature class, in which case it will be in the "Hosted" folder no matter what you told it to do when you published it.

UNLESS it's a map image layer and you TOLD it to publish it in the "Hosted" folder, in which case it will not be there. It will be in the / (root) folder. 

Note also if you tell it to put things in folders on the Portal from Python, sometimes it ignores that too. You have to create the service and then move it. 

It won't tell you when it's ignoring your requests to put things in folders, they just won't be there.

UNLESS it's Monday after a three day weekend and you're publishing from ArcGIS Pro 2.9 in which case it probably just won't work at all.

HAHHAHAHAHA an alert box just randomly popped up on my screen that said "Tell us what you think"!!!!

What great timing. I believe that's what I am doing here.

This is the short answer to my question - So okay, I can list folders FOR A USER. Because they have no other meaning. I get it now. Moving on,

Cloning Content

I just ran across this "https://developers.arcgis.com/python/guide/cloning-content/" "Cloning Content" thing. I will check that out. I wish Esri had told me about it a few weeks ago but I've learned lots about the internals so I am not bothered by it.

I wonder if it even knows about Portal folders? I wonder if I will stop using them soon? Maybe tags or categories are better? I only started using them because I expected them to act like, well, "folders".

I wonder if it works when version numbers are not the same?

I wonder if I can test it without having access to both servers? 

So much wonder! And all before lunch!

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

Tech Support would be your best option.  They would be able to put you in touch with someone who might know


... sort of retired...
0 Kudos