Skip to content
This repository has been archived by the owner on Jan 6, 2019. It is now read-only.

WorkItemLinks collection always empty in PreviousRevision #10

Closed
willstones opened this issue Dec 13, 2018 · 0 comments
Closed

WorkItemLinks collection always empty in PreviousRevision #10

willstones opened this issue Dec 13, 2018 · 0 comments

Comments

@willstones
Copy link

willstones commented Dec 13, 2018

I'm having a problem with the WorkItemLinks collection for a work item PreviousRevision. I have the following code which attempts to find either the current parent, or if there isn't one and it just got removed then the previous one.

Whenever I delete a link from a child to a parent the following code for the child work item never finds the old parent, and always logs "Work item X does not have a previous parent".

Any ideas?

        IWorkItemExposed parent = self.Parent;
        if(parent == null)
        {
            IWorkItemLinkExposed parentLink = self.PreviousRevision.WorkItemLinks.FirstOrDefault(wi => wi.LinkTypeEndImmutableName == WorkItemImplementationBase.ParentRelationship);
            if (parentLink != null)
            {
                parent = parentLink.Target;
            }
            else
            {
                logger.Log("Work item {0} does not have a previous parent", self.Id);
            }
        }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants