It's all about the answers!

Ask a question

Getting an IAttribute object from an attribute id on a server extension

Philipp H (53614) | asked Aug 18 '16, 5:05 a.m.
 Hi everyone,

I want to use getValue on a WorkItem in my Server Extension, but for that I need an IAttribute object.
I have the attribute id.
How do I get the IAttribute object?


For reference I tried:
this, this and some bits of this which gave me the error:
failed to find the required service 'interface'
even tho I have IWorkItemCommon in my prerequisites.

3 answers

permanent link
Michele Pegoraro (1.8k14119103) | answered Aug 18 '16, 5:09 a.m.
You probably need to use IWorkItemServer (which extend IWorkItemCommon) as prerequisite and in the getService method. Then you can also use it for the rest of the operation or cast it to IWorkItemCommon.

permanent link
Ralph Schoon (63.2k33646) | answered Aug 18 '16, 5:54 a.m.
edited Aug 18 '16, 5:55 a.m. shows how this is done in a participant/follow up action and the same mechanism applies in advisors/precondition. It is basically the same mechanism explained in where you don't specify the context.

You should use IWorkItemCommon wherever you can and it is possible to use it here. I don't know why you can't get it. I agree with Michele on the alternative and the example above uses IWorkItemServer an works. 

permanent link
Philipp H (53614) | answered Aug 19 '16, 1:54 a.m.
 I had to recreate the plugin project for the WorkItemServer to work. weird...

Michele Pegoraro commented Aug 19 '16, 10:03 a.m. | edited Aug 19 '16, 10:03 a.m.

Well, if you change a something in the plugin.xml (like the prerequisites) you always have to recompile and restart the server, also when you are on debug mode.

Philipp H commented Aug 22 '16, 1:51 a.m.

yeah I did restart the server and recompile, but fsr it didn't work.

Glad it works now tho and thanks for your response

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.