Export (0) Print
Expand All
Expand Minimize

RetrieveExchangeRate Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online and offline

Retrieves the exchange rate.

The relevant classes are specified in the following table.

TypeClass
RequestRetrieveExchangeRate
ResponseRetrieveExchangeRate

Remarks

To use this message, pass an instance of the RetrieveExchangeRate class as the request parameter in the Execute method.

For a list of required privileges, see RetrieveExchangeRate Privileges.

Example

The following code example shows how to use the RetrieveExchangeRate message.

[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 exchange rate request.
RetrieveExchangeRateRequest currencyExchangeRate = new RetrieveExchangeRateRequest();
currencyExchangeRate.TransactionCurrencyId = new Guid("b4502053-6968-dc11-bb3a-0003ffbad8542");

// Execute the request.
RetrieveExchangeRateResponse currencyExchangeResponse = (RetrieveExchangeRateResponse)service.Execute(currencyExchangeRate);

// Access the retrieved exchange rate.
decimal retrievedExchangeRate = currencyExchangeResponse.ExchangeRate;
[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 exchange rate request.
Dim currencyExchangeRate As New RetrieveExchangeRateRequest()
currencyExchangeRate.TransactionCurrencyId = New Guid("b4502053-6968-dc11-bb3a-0003ffbad8542")

' Execute the request.
Dim currencyExchangeResponse As RetrieveExchangeRateResponse = CType(service.Execute(currencyExchangeRate), RetrieveExchangeRateResponse)

' Access the retrieved exchange rate.
Dim retrievedExchangeRate As Decimal = currencyExchangeResponse.ExchangeRate

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft