Hi Guys,
I refer to this example - Project.Current.SaveAs method.
ProSnippets Content · Esri/arcgis-pro-sdk Wiki · GitHub
I try and save into a particular unc path location,
Example when I save into
"//unc path start/untitled1/untitled1.aprx" location,
that actually saving in like //unc path start/untitled1/untitled1.aprx/untitled1.aprx
Later I change my code for parameter value "//unc path start/untitled1" as I thought, I might make mistake.
that actually saving in like //unc path start/untitled1.aprx/untitled1.aprx
I am using pro version 2.5, project type is blank project and I called that saveas method at during project saving event.
Is that pro sdk bug or any idea about it? Mehdi Pira Uma Harano Wolfgang Kaiser
It is related to that question https://community.esri.com/thread/258880-limiting-project-saving-location
Best Regards,
Than
Solved! Go to Solution.
Regarding option 2: the location string will get overwritten each time the operator changes it from the backstage options window. The content of the user.config is self explained, simply make the change from your options menu and check the tag that's being used to store your change.
I think your problem is caused by the fact that you are calling the snippet during the project saving event. I implemented a simple button and experienced no issues with the path. However, if you look closely at what 'save as' does, you will notice that it only saves the .aprx file in the 'save as' path, the local database and other project artifacts stay behind in the local path. There are some workarounds for this:
1) You can save a 'project package' each time the user is trying to 'save' a project and then set the project's dirty flag to false. This will actually copy everything to the shared unc location. However, once you open the project package you have to perform the same 'save as' workflow each time since otherwise the 'save' operation (on an opened project package) saves now and aprx on the local drive.
2) You can change the project 'default' locations in the ArcGIS options:
3) Similar to 2) above you can provide a 'customized create new projects button' which makes use of the following project class method: CreateAsync (CreateProjectSettings createProjectSettings) createProjectSettings allows you to specify the default locations (in your case the unc path).
Thank Wolfgang Kaiser for your reply,
May be I shall create new ribbon button and test about save as different location, but based on you explanation, the local gdb and other reference artifact remained at old project location.
For option 1: it look like the workflow is quite complicated. Is there any simple way we can manage from sdk or sdk with python tool?
For option 2: Create Projects : Project Location , is there any way to automate and set the custom location from sdk config/module project type? I think configx project type seems to be achievable. Lets say If we can do that, for the blank project type, if user don't save it, when will those temporary projects removed? and How will those be removed?
For option 3: User already rejected about that before I posted this question in geonet, they don't want that way and prefer to happily play as blank project. If they don't want to save, they can neglect to save.
Best Regards,
Than
Option 1: you have to look at the parameters here: Package Project (Data Management)—ArcGIS Pro | Documentation
and call the geoprocessing task as demonstrated here: arcgis-pro-sdk-community-samples/Geoprocessing/GeoprocessingExecuteAsync at master · Esri/arcgis-pro...
Option 2: no, the SDK doesn't support read/write to backstage properties. I guess you can try to write the property into the user.config settings file (%appdata%\Esri\ArcGISPro.exe_StrongName....\2.6.0.0\user.config) where these properties are stored. New projects will not be removed since Pro saves them automatically. 'New' projects are only deleted if the operator deletes the project folder.
Thank Wolfgang Kaiser,
Option 1: It look like, it is require to perform at project save event(Project already save). So that I can launch packaging python script. So need to package and Save, after that need to extract to aprx, and then reopen. So it is very complicated, I won't try that.
Option 2: Most likely very straight forward, Is there any doco for user.config settings? There are lot of setting inside, since it is in the %appdata%\Local\ESRI\ArcGISPro.exe_StrongName_yhpsrysqpn4fvmb0spwbakt5o5e50din\2.5.0.0
Will it be overwritten by any of the process?
Best Regards,
Than
Regarding option 2: the location string will get overwritten each time the operator changes it from the backstage options window. The content of the user.config is self explained, simply make the change from your options menu and check the tag that's being used to store your change.
Thank Wolfgang Kaiser,
For now it is the best and simplest approach for me,