It's all about the answers!

Ask a question

Retrieving mail id of a contributor using Java API from work item


Sachin Nairy (5111119) | asked Aug 29 '13, 3:43 a.m.
edited Aug 29 '13, 6:58 p.m. by Geoffrey Clemm (30.1k23035)

Hi,

I want to retrieve mail id of a contributor using Java API from work item,

 i created one custom attribute type contributor, once work item created i want to retrieve mail id of that particular user.

Any suggestions

 

Thanks

Sachin Nairy

Accepted answer


permanent link
Michele Pegoraro (1.8k12114102) | answered Aug 29 '13, 6:14 a.m.
 Hi,
you can obtain this information from an IContributor object using getEmailAddress() method.

From a work item you only have to retrieve the contributor (I suppose from the author or the owner) as a IContributorHandle and then retrive the object using the IItemManager.

Best regards,
Michele. 
Sachin Nairy selected this answer as the correct answer

Comments
Sachin Nairy commented Aug 29 '13, 7:58 a.m.

Thanks Michele,

I am creating  server side plug-in, used below code to retrieve. But IItemManager & getEmailAddress is not resolving, Any specific package i have to import?

IContributorHandle createor = workItem.getCreator();

IItemManager mid = createor.getEmailAddress();


Michele Pegoraro commented Aug 29 '13, 9:09 a.m.

On server side you have to use IRepositoryItemService instead of IItemManager (which is used by plain api, not sdk).


IRepositoryItemService itemService = getService(IRepositoryItemService.class);
IContributorHandle creatorH = workItem.getCreator();
IContributor creator = (IContributor)itemService.fetchItem(creatorH,IRepositoryItemService.COMPLETE);
creator.getEmailAddress(); 

You have also to set IRepositoryItemService as prerequired service. Is not so simple if you have not develop other stuff on RTC server side. I suggest you to take a look to the SDK wiki page (the examples on follow-up and advisor creation).


Sachin Nairy commented Aug 30 '13, 4:30 a.m.

Thanks a lot Michele, its working fine.

Your answer


Register or to post your answer.