// Get the Uri for the TR before disconnected assuming disconnect was done in // previous save. Preconditions should be checked by caller. static public Uri getDisconnectedTRLink( Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem, WorkItemChangedEvent notification) { // Apparently we need to check on second last revision to get the correct // value for the previous value. This does not show in UI, but is clear when // debugging. So check we have > 2 revisions, and then compare. if (workItem.Revision < 3) { return(null); } Revision lastRev = workItem.Revisions[workItem.Revision - 2]; String oldTrLink = lastRev.Fields[TFSMapper.ERICSSON_DEFECT_LINK_FIELD].Value.ToString(); if (oldTrLink == null || oldTrLink.Length == 0) { return(null); } HandlerSettings.LogMessage( String.Format( "Disconnected TR '{0}' from WorkItem with id {1}.", oldTrLink, "" + workItem.Id), HandlerSettings.LoggingLevel.INFO); return(new Uri(HandlerSettings.GetUriForTR(oldTrLink))); }