GetTimeZoneCodeByLocalizedName 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 the time-zone code for the specified localized time-zone name.
The relevant classes are specified in the following table.
| Type | Class |
| Request | GetTimeZoneCodeByLocalizedNameRequest |
| Response | GetTimeZoneCodeByLocalizedNameResponse |
Remarks
To use this message, pass an instance of the GetTimeZoneCodeByLocalizedNameRequest class as the request parameter in the Execute method.
For a list of required privileges, see GetTimeZoneCodeByLocalizedName 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;
// Create the request
GetTimeZoneCodeByLocalizedNameRequest timeZoneCodeRequest = new GetTimeZoneCodeByLocalizedNameRequest();
// Use US English for the request
timeZoneCodeRequest.LocaleId = 1033;
timeZoneCodeRequest.LocalizedStandardName = "Pacific Standard Time";
// Execute the request
GetTimeZoneCodeByLocalizedNameResponse timeZoneCodeResponse = (GetTimeZoneCodeByLocalizedNameResponse)service.Execute(timeZoneCodeRequest);
// Access the time zone code
int pacificStandardTimeCode = timeZoneCodeResponse.TimeZoneCode;
[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
' Create the request.
Dim timeZoneCodeRequest As New GetTimeZoneCodeByLocalizedNameRequest()
' Use US English for the request.
timeZoneCodeRequest.LocaleId = 1033
timeZoneCodeRequest.LocalizedStandardName = "Pacific Standard Time"
' Execute the request.
Dim timeZoneCodeResponse As GetTimeZoneCodeByLocalizedNameResponse = CType(service.Execute(timeZoneCodeRequest), GetTimeZoneCodeByLocalizedNameResponse)
' Access the time zone code.
Dim pacificStandardTimeCode As Integer = timeZoneCodeResponse.TimeZoneCode
See Also
Concepts
Reference
.gif)