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

SetIsAddedToAllNewProjects Method
Sets the Favorite.IsAddedToAllNewProjects value to true for the specified item in the favorite collection.
Syntax
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 itemFolder = ItemFactory.Instance.Create(@"d:\data");

// is the folder item already a favorite?
var fav = FavoritesManager.Current.GetFavorite(itemFolder);
if (fav != null)
{
  if (fav.IsAddedToAllNewProjects)
    FavoritesManager.Current.ClearIsAddedToAllNewProjects(fav.Item);
  else
    FavoritesManager.Current.SetIsAddedToAllNewProjects(fav.Item);
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also