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

1226
3
Jump to solution
01-23-2022 01:32 AM
JadedEarth
Occasional Contributor

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
Occasional Contributor

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;
}
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
Occasional Contributor

Thank you.  Solves my problem.

0 Kudos