Term.Merge Method
Merge the current Term object with the specified Term and return the combined Term.
Namespace: Microsoft.SharePoint.Taxonomy
Assembly: Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)
Syntax
'Declaration
Public Function Merge ( _
termToMerge As Term _
) As Term
'Usage
Dim instance As Term
Dim termToMerge As Term
Dim returnValue As Term
returnValue = instance.Merge(termToMerge)
public Term Merge(
Term termToMerge
)
Parameters
termToMerge
Type: Microsoft.SharePoint.Taxonomy.TermThe current Term
Return Value
Type: Microsoft.SharePoint.Taxonomy.Term
The merged Term
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The Term to merge into is a null reference (Nothing in Visual Basic). |
ArgumentException | The Term to merge into is invalid. |
TermStoreOperationException | This operation is invalid in the orphaned terms TermSet object.The operation failed. |
TermStoreOperationException | Cannot merge a Term to its reused Term. |
TermStoreOperationException | Only a source Term can be merged into another source Term. |
TermStoreOperationException | Merge is not allowed for the two specified Term objects. The source Term and the target Term of merge are reused in the same TermSet object, and must be siblings in that TermSet in order to be mergeable. |
UnauthorizedAccessException | The current user has insufficient permissions to perform this operation. |
Remarks
The current Term is the Term to merge from, and the termToMerge is the Term to merge into (the target Term). After the Merge() operation is complete, both Term objects become reused, and the targetTerm becomes the source of the reused Term objects. The target TermGUID becomes the GUID of the merged Term. The current Term GUID is added to MergedTermIds
The Term GUID in the custom sort order of the parents of the current Term or any of its reused copies is updated with the target Term GUID.
The custom sort order is merged in the following way: if the target Term has a custom sort order, then the source Term sort order is appended to it. Otherwise, if the target Term does not have a custom sort order but the source Term does, then a custom sort order is enforced based on alphabetical order in the current working language ( WorkingLanguage), and the source Term custom sort order is appended to it.
The current user must have TaxonomyRights.EditTerm permission on both the current Term and the Term to merge into in order to use this method. Call the CommitAll() method to save this change to the database.