Update Manual Relationships (Custom Relationships)
The method updates the manually created relationships between an item and other items, adding a new custom relationship.
- Connect to the configuration web service.
- Specify the identifier of the item.
- Specify the identifier of the target item.
- Specify the identifier of the custom relationship type definition identifier.
Code Sample
# Set the variables.
$itemID = 1234;
$targetItemID = 5678;
$relationshipDefinitionIdentifier = "f707b4a9-ce3c-447a-921a-b1d72769be14";
# Get the manual relationships.
$manualRelationships = $xia.GET_ManualRelationships($itemID);
# Create a new relationship.
$manualRelationship = New-Object "$($xia.GetType().Namespace).ManualRelationship";
$manualRelationship.CreateInboundConnection = $false;
$manualRelationship.DefinitionIdentifier = $relationshipDefinitionIdentifier;
$manualRelationship.RelationshipType = "Custom";
$manualRelationship.TargetItemID = $targetItemID;
# Add the manual relationship to the collection.
$manualRelationships.ManualRelationship += $manualRelationship;
# Update the relationships.
$xia.SET_ManualRelationships($itemID, $manualRelationships);