ArcGIS Pro SDK Add-In C#: How to get /set the Home Folder Option Path

190
3
Jump to solution
01-23-2022 01:32 AM
JadedEarth
New Contributor III

Is it possible to set programmatically the Home Folder Path of a project?  And then also get the path after setting it?

I can manually set it in Options settings.  But having problems trying to get the home folder path in my program.  

I don't want to use the default C:\ drive since sometimes users have no access to it in our servers.

Appreciate any help.

0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

Note: if u wanted to change the default (default"s") for all projects u might find these snippets useful:

https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Content#set-generaloptions-to-use-defaults 

View solution in original post

0 Kudos
3 Replies
JadedEarth
New Contributor III

Never mind.  Found out the solution:

var homeDir = Project.Current.HomeFolderPath;

var drive = Directory.GetDirectoryRoot(homeDir);
if (drive == "C")
{
    //Set the current directory.
    Project.Current.SetHomeFolderPath(working_folder);
}
else
{
   //Disable controls
    TboxWorkingDir.IsEnabled = false;
    BtnSetup.IsEnabled = false;
}
0 Kudos
CharlesMacleod
Esri Regular Contributor

Note: if u wanted to change the default (default"s") for all projects u might find these snippets useful:

https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Content#set-generaloptions-to-use-defaults 

0 Kudos
JadedEarth
New Contributor III

Thank you.  Solves my problem.

0 Kudos