public override LinkChangeAction CreateLinkDeletionAction(string sourceItemUri, string targetArtifactUrl, string linkTypeReferenceName) { var link = new Toolkit.Linking.ArtifactLink( TfsWorkItemHandler.IdFromUri(sourceItemUri), new Toolkit.Linking.Artifact(sourceItemUri, s_sourceArtifactType), new Toolkit.Linking.Artifact(targetArtifactUrl, s_targetArtifactType), string.Empty, this); return(new LinkChangeAction(WellKnownChangeActionId.Delete, link, LinkChangeAction.LinkChangeActionStatus.Created, false)); }
public bool UpdateTfs(TfsUpdateDocument updateDoc, LinkChangeAction linkChangeAction) { if (null == updateDoc) { throw new ArgumentNullException("updateDoc"); } if (null == linkChangeAction) { throw new ArgumentNullException("linkChangeAction"); } if (!linkChangeAction.Link.LinkType.ReferenceName.Equals(REFERENCE_NAME)) { throw new ArgumentException("Link type mismatch."); } //if (!linkChangeAction.ChangeActionId.Equals(WellKnownChangeActionId.Add)) //{ // Debug.Assert(false, "Unsupported action!"); // TraceManager.TraceError("Non-add action on external links is not supported."); //} string uri = linkChangeAction.Link.TargetArtifact.Uri; string comment = linkChangeAction.Link.Comment; if (linkChangeAction.ChangeActionId.Equals(WellKnownChangeActionId.Add)) { updateDoc.AddWorkItemLink(TfsWorkItemHandler.IdFromUri(uri), comment); } else if (linkChangeAction.ChangeActionId.Equals(WellKnownChangeActionId.Delete)) { updateDoc.RemoveWorkItemLink(TfsWorkItemHandler.IdFromUri(uri)); } else { throw new MigrationException(TfsWITAdapterResources.ErrorUnsupportedChangeAction); } return(true); }