It's all about the answers!

Ask a question

How to get creator Id using plain Java api?

kishan adhi (44279) | asked May 09 '13, 4:03 p.m.
Hi I am trying to get creator ID from workItem .
When i use the method
WorkItem.getCreator() I get the following message
62b (stateId: <unset>, itemId: [UUID _noTKsbToEeCJhYt-X0WSYQ], origin:
eam.repository.client.internal.TeamRepository@20772077, immutable: true)

Please suggest me how i can pull the creator name or email Address from the work Item.

Any suggestions are welcome


Accepted answer

permanent link
sam detweiler (12.5k6194201) | answered May 09 '13, 6:37 p.m.
you need to convert the handle into a IContributor object

 IContributor User = (IContributor) teamRepository.itemManager().fetchCompleteItem(
                                                               IContributorHandle, IItemManager.DEFAULT. monitor);

print user.getName();
kishan adhi selected this answer as the correct answer

kishan adhi commented May 10 '13, 8:32 a.m.

Thanks Sam it worked G8

One other answer

permanent link
Kasia Srubka (111) | answered May 28 '18, 6:01 a.m.
edited May 28 '18, 6:06 a.m.
Thanks Sam, it worked for me too. I fixed punctuation a little ;)
IContributorHandle creator = attachment.getCreator();
IProgressMonitor monitor = new SysoutProgressMonitor();
IContributor user = (IContributor) teamRepository.itemManager()
.fetchCompleteItem(creator, IItemManager.DEFAULT, monitor);"WorkItem attachment creator: " + user.getName());

Your answer

Register or to post your answer.