GetAllTimeZonesWithDisplayName Message (CrmService)
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
Find the latest SDK documentation: CRM 2015 SDK
| Works for all deployment types | Works online and offline |
Retrieves all the time-zone definitions for the specified locale returning only the display name attribute.
The relevant classes are specified in the following table.
| Type | Class |
| Request | GetAllTimeZonesWithDisplayNameRequest |
| Response | GetAllTimeZonesWithDisplayNameResponse |
Remarks
To use this message, pass an instance of the GetAllTimeZonesWithDisplayNameRequest class as the request parameter in the Execute method.
For a list of required privileges, see GetAllTimeZonesWithDisplayName Privileges.
Language codes are four- or five-digit Locale IDs. Valid Locale ID values can be found at Locale ID (LCID) Chart.
Example
[C#]
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0;
token.OrganizationName = "AdventureWorksCycle";
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Store all time zone display names
ArrayList timeZoneDisplayNames = new ArrayList();
// Create the request
GetAllTimeZonesWithDisplayNameRequest timeZonesRequest = new GetAllTimeZonesWithDisplayNameRequest();
// Retrieve display names in US English
timeZonesRequest.LocaleId = 1033;
// Execute the request
GetAllTimeZonesWithDisplayNameResponse timeZonesResponse = (GetAllTimeZonesWithDisplayNameResponse)service.Execute(timeZonesRequest);
// Get all time zone display names
foreach (BusinessEntity businessEntity in timeZonesResponse.BusinessEntityCollection.BusinessEntities)
{
timezonedefinition timeZone = (timezonedefinition)businessEntity;
timeZoneDisplayNames.Add(timeZone.userinterfacename);
}
[Visual Basic .NET]
' Set up the CRM service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials
' Store all time zone display names.
Dim timeZoneDisplayNames As New ArrayList()
' Create the request.
Dim timeZonesRequest As New GetAllTimeZonesWithDisplayNameRequest()
' Retrieve display names in US English.
timeZonesRequest.LocaleId = 1033
' Execute the request.
Dim timeZonesResponse As GetAllTimeZonesWithDisplayNameResponse = CType(service.Execute(timeZonesRequest), GetAllTimeZonesWithDisplayNameResponse)
' Get all time zone display names.
For Each businessEntity As BusinessEntity In timeZonesResponse.BusinessEntityCollection.BusinessEntities
Dim timeZone As timezonedefinition = CType(businessEntity, timezonedefinition)
timeZoneDisplayNames.Add(timeZone.userinterfacename)
Next businessEntity
See Also
Concepts
Reference
.gif)