It's all about the answers!

Ask a question

Accessing information on a WorkItem of a linked WorkItem

Philipp H (53614) | asked Aug 09 '16, 2:52 a.m.
edited Aug 09 '16, 2:55 a.m.
 Hi everyone, I have a custom WorkItem that has 2 links to other custom WorkItems. I want to create an extension that automatically copies the HTMLSummary from the second linked WorkItem to the saved WorkItem. 
to get to my linked workitem, but I can't seem to get any information out of it. 
I'm currently stuck at this:
if(resolvedRef instanceof IWorkItemHandle){
	IWorkItemHandle handle = (IWorkItemHandle)resolvedRef;
How do I check if this IWorkItemHandle is my second link?
How do I access it's fields/HTMLSummary?


sam detweiler commented Aug 09 '16, 7:56 a.m. | edited Aug 09 '16, 8:46 a.m.

the design of the system uses a small representation of the objects as the persistent data. its a 'handle' to the real object.  the handle does NOT contain any useful data.
this reduces memory consumption for what is expected to be large numbers of objects.

you must ask the system to populate (resolve) the object with the data elements you need.

the resolve 'profiles' (small, medium, large, default) select the data elements you need.   (you can create your own profile on the fly to get only specific data elements)

As an example, in one of my applications, I only need the email address of the user (IContributor), so that is all I ask the system to get me.. no point retrieving the other data if its not going to be used.

Philipp H commented Aug 09 '16, 8:02 a.m.

 Ok, thanks for explaining!

Accepted answer

permanent link
Ralph Schoon (63.2k33646) | answered Aug 09 '16, 3:02 a.m.
Please see . You have to resolve the handle.
Philipp H selected this answer as the correct answer

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.