Tagging
public static class TaggingStateless API for creating tags, assigning or removing package and file tags, and querying tag metadata.
Methods
Section titled “Methods”
AddAssignment(int, string, Target, bool)
Section titled “AddAssignment(int, string, Target, bool)”public static bool AddAssignment(int targetId, string tag, TagAssignment.Target target, bool fromAssetStore = false)Assigns a tag to a package or indexed file when the relationship does not already exist.
Parameters
| Name | Type |
|---|---|
targetId |
System.Int32 |
tag |
System.String |
target |
AssetInventory.TagAssignment.Target |
fromAssetStore |
System.Boolean |
Returns
System.Boolean
AddAssignment(AssetInfo, string, Target, bool)
Section titled “AddAssignment(AssetInfo, string, Target, bool)”public static bool AddAssignment(AssetInfo info, string tag, TagAssignment.Target target, bool byUser = false)Assigns a tag to a package or indexed file when the relationship does not already exist.
Parameters
| Name | Type |
|---|---|
info |
AssetInventory.AssetInfo |
tag |
System.String |
target |
AssetInventory.TagAssignment.Target |
byUser |
System.Boolean |
Returns
System.Boolean
AddAssignments(List, string, Target, bool)
Section titled “AddAssignments(List, string, Target, bool)”public static void AddAssignments(List<AssetInfo> infos, string tag, TagAssignment.Target target, bool byUser = false)Assigns the named tag to each supplied package or indexed file, skipping relationships that already exist.
Parameters
| Name | Type |
|---|---|
infos |
System.Collections.Generic.List{AssetInventory.AssetInfo} |
tag |
System.String |
target |
AssetInventory.TagAssignment.Target |
byUser |
System.Boolean |
RemoveAssignment(AssetInfo, TagInfo, bool, bool)
Section titled “RemoveAssignment(AssetInfo, TagInfo, bool, bool)”public static void RemoveAssignment(AssetInfo info, TagInfo tagInfo, bool autoReload = true, bool byUser = false)Removes a package or file tag assignment without deleting the tag definition.
Parameters
| Name | Type |
|---|---|
info |
AssetInventory.AssetInfo |
tagInfo |
AssetInventory.TagInfo |
autoReload |
System.Boolean |
byUser |
System.Boolean |
RemoveAssetAssignments(List, string, bool)
Section titled “RemoveAssetAssignments(List, string, bool)”public static void RemoveAssetAssignments(List<AssetInfo> infos, string name, bool byUser)Removes the named tag from the supplied indexed files while leaving package assignments unchanged.
Parameters
| Name | Type |
|---|---|
infos |
System.Collections.Generic.List{AssetInventory.AssetInfo} |
name |
System.String |
byUser |
System.Boolean |
RemovePackageAssignments(List, string, bool)
Section titled “RemovePackageAssignments(List, string, bool)”public static void RemovePackageAssignments(List<AssetInfo> infos, string name, bool byUser)Removes the named tag from the supplied packages while leaving file assignments unchanged.
Parameters
| Name | Type |
|---|---|
infos |
System.Collections.Generic.List{AssetInventory.AssetInfo} |
name |
System.String |
byUser |
System.Boolean |
GetAssetTags(int)
Section titled “GetAssetTags(int)”public static List<TagInfo> GetAssetTags(int assetFileId)Returns tags currently assigned to the selected indexed file.
Parameters
| Name | Type |
|---|---|
assetFileId |
System.Int32 |
Returns
System.Collections.Generic.List{AssetInventory.TagInfo}
GetPackageTags(int)
Section titled “GetPackageTags(int)”public static List<TagInfo> GetPackageTags(int assetId)Returns tags currently assigned to the selected package.
Parameters
| Name | Type |
|---|---|
assetId |
System.Int32 |
Returns
System.Collections.Generic.List{AssetInventory.TagInfo}
SaveTag(Tag)
Section titled “SaveTag(Tag)”public static void SaveTag(Tag tag)Persists changes to an existing tag definition and refreshes the cached tag hierarchy.
Parameters
| Name | Type |
|---|---|
tag |
AssetInventory.Tag |
AddTag(string, bool)
Section titled “AddTag(string, bool)”public static Tag AddTag(string name, bool fromAssetStore = false)Creates a tag at the supplied hierarchical path, optionally persisting it immediately.
Parameters
| Name | Type |
|---|---|
name |
System.String |
fromAssetStore |
System.Boolean |
Returns
AssetInventory.Tag
RenameTag(Tag, string)
Section titled “RenameTag(Tag, string)”public static void RenameTag(Tag tag, string newName)Renames the tag and updates cached tag paths for its descendants without changing assignments.
Parameters
| Name | Type |
|---|---|
tag |
AssetInventory.Tag |
newName |
System.String |
DeleteTag(Tag)
Section titled “DeleteTag(Tag)”public static void DeleteTag(Tag tag)Deletes the selected tag definition and its assignments while retaining descendant tag definitions.
Parameters
| Name | Type |
|---|---|
tag |
AssetInventory.Tag |
DeleteTagWithDescendants(Tag)
Section titled “DeleteTagWithDescendants(Tag)”public static void DeleteTagWithDescendants(Tag tag)Deletes the selected tag, every descendant tag, and all of their assignments.
Parameters
| Name | Type |
|---|---|
tag |
AssetInventory.Tag |
GetDescendantTags(int)
Section titled “GetDescendantTags(int)”public static List<Tag> GetDescendantTags(int tagId)Returns every direct and indirect child of the supplied tag identity.
Parameters
| Name | Type |
|---|---|
tagId |
System.Int32 |
Returns
System.Collections.Generic.List{AssetInventory.Tag}
LoadTags()
Section titled “LoadTags()”public static List<Tag> LoadTags()Reloads tag definitions and assignments from the active catalog and rebuilds their hierarchy paths.
Returns
System.Collections.Generic.List{AssetInventory.Tag}
GetDescendantTagIds(int)
Section titled “GetDescendantTagIds(int)”public static HashSet<int> GetDescendantTagIds(int tagId)Returns the catalog identities of every direct and indirect child of the supplied tag.
Parameters
| Name | Type |
|---|---|
tagId |
System.Int32 |
Returns
System.Collections.Generic.HashSet{System.Int32}
AddTagWithSlashHandling(string, bool)
Section titled “AddTagWithSlashHandling(string, bool)”public static Tag AddTagWithSlashHandling(string name, bool fromAssetStore = false)Adds a tag with slash handling based on the global setting. When CreateHierarchy: splits on “/” and creates parent chain with proper ParentId relationships. When TakeAsIs: creates tag with “/” in the name literally.
Parameters
| Name | Type |
|---|---|
name |
System.String |
fromAssetStore |
System.Boolean |
Returns
AssetInventory.Tag
GetTagsWithSlash()
Section titled “GetTagsWithSlash()”public static List<Tag> GetTagsWithSlash()Returns all tags that contain “/” in their name.
Returns
System.Collections.Generic.List{AssetInventory.Tag}
CheckConversionConflicts(Tag)
Section titled “CheckConversionConflicts(Tag)”public static List<(string segment, Tag existingTag, int? currentParentId, int? newParentId)> CheckConversionConflicts(Tag tag)Checks if converting a slash tag to hierarchy would cause reparenting conflicts. Returns a list of tags that would be reparented (already exist with a different parent).
Parameters
| Name | Type |
|---|---|
tag |
AssetInventory.Tag |
Returns
System.Collections.Generic.List{System.ValueTuple{System.String,AssetInventory.Tag,System.Nullable{System.Int32},System.Nullable{System.Int32}}}
ConvertSlashTagToHierarchy(Tag, bool)
Section titled “ConvertSlashTagToHierarchy(Tag, bool)”public static bool ConvertSlashTagToHierarchy(Tag tag, bool forceReparent = false)Converts a tag containing “/” into a proper hierarchy. Splits on “/”, creates/reuses tags with proper ParentId chain, reassigns all TagAssignment records to the leaf tag, and deletes the original “/” tag.
Parameters
| Name | Type | Description |
|---|---|---|
tag |
AssetInventory.Tag | The tag containing “/” to convert |
forceReparent |
System.Boolean | If true, will reparent existing tags even if they have a different parent |
Returns
System.Boolean: True if conversion succeeded, false otherwise
ConvertAllSlashTagsToHierarchy()
Section titled “ConvertAllSlashTagsToHierarchy()”public static (int convertedCount, List<(Tag tag, List<(string segment, Tag existingTag, int? currentParentId, int? newParentId)> conflicts)> skipped) ConvertAllSlashTagsToHierarchy()Converts all tags containing “/” to hierarchy structure. Auto-converts those without conflicts and returns list of skipped tags.
Returns
System.ValueTuple{System.Int32,System.Collections.Generic.List{System.ValueTuple{AssetInventory.Tag,System.Collections.Generic.List{System.ValueTuple{System.String,AssetInventory.Tag,System.Nullable{System.Int32},System.Nullable{System.Int32}}}}}}: Tuple of (converted count, list of skipped tags with their conflict reasons)
Events
Section titled “Events”
OnTagsChanged
Section titled “OnTagsChanged”public static event Action OnTagsChangedRaised after tags changed so open views and integrations can refresh their cached catalog state.
Returns
System.Action