Has anyone tried the 'updateFolderConnections' Command?

463
4
03-16-2023 04:44 PM
rescobar
New Contributor III

Hello, 

I see this command: 'updateFolderConnections' in the ArcGISProject documentation (https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm) but I don't see any examples of how to use the tool. Does anyone have any example code that uses this command? 

I don't really understand the entry, what would the dictionaries contain exactly?

updateFolderConnections (folder_connections, {validate})

Replaces project folder connections using a list of dictionaries that describe each connection.

4 Replies
DavidSolari
Occasional Contributor III

The expanded method help makes this clearer. You pass in a list that contains dictionaries, one dictionary per folder connection. Each dictionary has three keys and associated values: "connectionString" (A local or UNC path to a system folder), "alias" (optional alias for the path in the catalog view) and "isHomeFolder" (True if this entry is for the home folder, False otherwise). Basically you're passing in an anonymous config object like it's a JavaScript function, even though Python supports named objects. Guess whoever wrote that interface had a long day and didn't want to define a proper object 😁.

0 Kudos
rescobar
New Contributor III

Thank you for breaking this down!

0 Kudos
rescobar
New Contributor III

Do you know if there's a similar command for database connections?

0 Kudos
rescobar
New Contributor III

Sorry, to spam you but I'm getting this error: 

AttributeError: 'ArcGISProject' object has no attribute 'updateFolderConnections'

 

from this code: 

 

aprx.updateFolderConnections (connections)

 

0 Kudos