It's all about the answers!

Ask a question

Accessing the Time Zone of User/Contributor of a Work item

Renuka Sindhgatta (13) | asked Jun 14 '10, 1:19 a.m.
Is is possible to access the TimeZone of the contributor of a workitem using the Java APIs ?

I get the IContributor of a work item and then access the IContributorDetails. But I am unable to get the time zone information in the details.


One answer

permanent link
Nick Edgar (6.5k711) | answered Jun 17 '10, 12:04 a.m.
It looks like the Work Location settings, including time zone, for a user are not stored as string extensions on the IContributorDetails (like work item email settings are) but rather as a modeled item in the Agile Planning support.
has properties: timeZone, zoneOffset, language, country, variant, workDays

I don't see any public API for obtaining this, but there's an internal client library.
ResourcePlanningManager getResourcePlanningManager()
IContributorInfo getContributorInfo(final IContributorHandle contributor, final boolean refresh, final IProgressMonitor monitor)
IWorkLocationDefinition getWorkLocation(IContributorHandle contributor)

So something like: teamRepository.getClientLibrary(ResourcePlanningClient.class).getResourcePlanningManager().getContributorInfo(contributorHandle, false, aMonitor).getWorkLocation(contributorHandle)
should do the trick.

Hopefully the planning team won't have my head for pointing you this way.

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.