It's all about the answers!

Ask a question

Query workspace using uuid

Sarath Shasikumar (1759) | asked Jul 25 '13, 3:18 a.m.
   Please help me to query workspace using UUID.
   My requirement is to find workspace associated to a build definition, but I can only find UUID of the workspace.
To get the real workspace I need to query workspace using UUID.

Can any body help in finding workspace using UUID.

Any help will be appreciated.

Thank you

Tim Mok commented Jul 25 '13, 10:06 a.m.

Can you clarify what you're trying to do? Is this using one of the clients to find a workspace or are you using the plain Java client libraries?

Sarath Shasikumar commented Jul 25 '13, 11:37 a.m.

I am using RTC sdk java client. I want to know how to get current workspace  for a build definition using sdk. I am getting an itemId but not the workspaceHandle.

is there any way to access workspace handle from a build definition directly ?
if I am having UUID how I can query a workspace using this itemID.

Accepted answer

permanent link
Shashikant Padur (4.2k27) | answered Jul 26 '13, 1:49 a.m.
IWorkspaceHandle wsHandle = (IWorkspaceHandle) IWorkspace.ITEM_TYPE.createItemHandle(itemId, null);
IWorkspace ws = repo.itemManager().fetchCompleteItem(wsHandle, IItemManager.DEFAULT, null);

repo (ITeamRepository) is your repository connection.
Sarath Shasikumar selected this answer as the correct answer

Sarath Shasikumar commented Jul 26 '13, 2:30 a.m.

Thank you, this code actually helped me to get workspace using UUID.

What I understood is, if we have itemID we can create handles directly for any type right ?

Shashikant Padur commented Jul 26 '13, 3:28 a.m.

Yes, that is correct.

Your answer

Register or to post your answer.