How to add predefined folder connections into favorites programmatically

1416
9
08-07-2019 07:01 PM
by Anonymous User
Not applicable

Hi Guys,

I saw a lot of sample code to add folder connection dynamically with sdk. But I got a requirement that the users want to have set of predefined folder connections into their favorite before they create the project. Is there any code snippet I can refer to?

9 Replies
UmaHarano
Esri Regular Contributor

Hi,

One way to accomplish this is to -

Thanks

Uma

by Anonymous User
Not applicable

Thank Uma,

This is the good idea.

And also your suggestion is one of the requirement for me to do so as well together with checking the existing project's folder connection to validate.

As an additional, they also want to add those connections into favorites.

I do manage to add folder into folder connection with below code

var folderToAdd = ItemFactory.Instance.Create(folderpath);
await QueuedTask.Run(() => Project.Current.AddItem(folderToAdd as IProjectItem);

One thing I can't manage to do is that can't find a way to add the folder path into favorites and read the existing paths from favorites.

And I am thinking whether it is good way to update [profile path]\AppData\Roaming\Esri\ArcGISPro\Favorites\favorites.json file as well.

 

I saw the command but there is precondition mentioned in it to call that command, [esri_geodatabase_addFolderConnectionToFavoritesButton] , not sure how to use that or is that correct one as well.

What do you recommend?

0 Kudos
UmaHarano
Esri Regular Contributor

Hi Than

The ability to add folder connections to the "Favorites" is slated to be available with 2.5 release. But in the meantime, you can definitely re-use the esri_geodatabase_addFolderConnectionToFavoritesButton button in your customization.  

Thanks

Uma

0 Kudos
by Anonymous User
Not applicable

Thank Uma,

I shall try use it and contact you when I encountered issue.

0 Kudos
by Anonymous User
Not applicable

Hi Uma Harano‌,

May I know how to do it in 2.5, since it is released.

I tried to find it in api doco url as below reference and didn't manage to find out.

I might have missed.

ArcGIS Pro 2.5 API Reference Guide 

ArcGIS Pro 2.5 API Reference Guide 

Thank and Best Regards,

Than

0 Kudos
UmaHarano
Esri Regular Contributor

Hi Than,

Unfortunately this did not make it in 2.5. I will reply to this thread when I have more information.

Thanks

Uma

0 Kudos
by Anonymous User
Not applicable

Thank Uma Harano

0 Kudos
by Anonymous User
Not applicable

Hi Uma Harano‌,

May I know whether that feature is available in 2.6 now?

by Anonymous User
Not applicable

Hi Uma Harano‌,

May I know whether that feature is available in 2.7 sdk already?

Best Regards,

Than

0 Kudos