I'm trying to create a link from a work item to the current server version of a file in TFS via the API. I can do it within Visual Studio (2012) so I know it's possible. However when I try and do it via code it fails with TF201038: Linked item does not exist or access is denied. See Work Item Permissions for Links (http://go.microsoft.com/fwlink/?LinkId=75624) for more details.
The link doesn't really give me any helpful suggestions.
The workitem and the object are both objects that I've created and just gone and got out of the VCS. The link type I'm trying to create exists because I've checked against the WorkItemLinkTypes.
I've created the correct ends for the link types and added a new related link to the workitem.
It's only when I do a WorkItem.Save that it gives me the error.
The workitem isn't access denied, isn't read only or anything odd like that.
Have I missed something ?