ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core Namespace / FavoritesManager Class / SetIsAddedToAllNewProjects Method
The item to be updated in the favorites collection.
Example

In This Topic
    SetIsAddedToAllNewProjects Method
    In This Topic
    Sets the Favorite.IsAddedToAllNewProjects value to true for the specified item in the favorite collection.
    Syntax
    Public Sub SetIsAddedToAllNewProjects( _
       ByVal item As Item _
    ) 
    public void SetIsAddedToAllNewProjects( 
       Item item
    )

    Parameters

    item
    The item to be updated in the favorites collection.
    Example
    Toggle the flag IsAddedToAllNewProjects for a favorite
    {
      var newItemFolder = ItemFactory.Instance.Create(@"d:\data");
    
      // is the folder item already a favorite?
      var favorite = FavoritesManager.Current.GetFavorite(newItemFolder);
      if (favorite != null)
      {
        if (favorite.IsAddedToAllNewProjects)
          FavoritesManager.Current.ClearIsAddedToAllNewProjects(favorite.Item);
        else
          FavoritesManager.Current.SetIsAddedToAllNewProjects(favorite.Item);
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also