I'm trying to remove all unnecessary connections in ArcGIS Pro with ArcPy. I'm running a script which picks up ArcGIS Pro Project template and makes a copy. Then adds new database and toolbox and makes these things as the default ones. But when I open newly created ArcGIS Pro aprx, database, toolbox and folder connection from template are still there. How can I remove them?
Part of my script:
import arcpy
aprx = arcpy.mp.ArcGISProject("path to template") #path to ArcGIS Pro template
database=arcpy.CreateFileGDB_management(Path,Name) #create database
aprx.defaultGeodatabase=database #set default database
aprx.homeFolder="Path to folder" #set default folder connection
aprx.saveACopy(new.aprx)
-
Perhaps they are amongst your Favorites in the Catalog pane.PolyGeo– PolyGeo ♦2022年10月06日 22:11:04 +00:00Commented Oct 6, 2022 at 22:11
-
Thanks @PolyGeo. But not really. There is nothing in my favorites. If i delete for instance toolbox and database from template folder, as soon as I open template aprx, these two reappear. I think its an ESRI thing. I can however set up default home folder, toolbox and database in my newly created aprx, but i cannot remove the old ones.Benas Pekarskis– Benas Pekarskis2022年10月06日 22:24:31 +00:00Commented Oct 6, 2022 at 22:24
-
Perhaps review gis.stackexchange.com/q/236262/115PolyGeo– PolyGeo ♦2022年10月06日 22:41:56 +00:00Commented Oct 6, 2022 at 22:41
1 Answer 1
(I work at Esri)
From some planning documents, I see "Add/remove folders and databases" (connections) as a targeted item in the near term. From that, I can infer that there is no arcpy.mp
command to simply remove these from the project. There still might be a way to accomplish this, but you won't find a straightforward arcpy command to do it.
Note - near term usually means within the next release or two (3.1 or 3.2), but priorities can change at any time, so this is no guarantee.