Retrieves a list of currency objects that match the specified criteria.
Parameter |
Type |
Description |
---|---|---|
criteria |
The currency criteria object that specifies which currency objects are returned. |
|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetCurrencyListResult |
The list of currency objects that match the specified criteria. |
The following C# example retrieves the list of currency objects that have the word “Dollar” in their description. The total number of currency objects returned is displayed in a message box.
Legacy endpoint
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program { static void Main(string[] args) { Context context; Currency[] currencyList; CurrencyCriteria currencyCriteria; LikeRestrictionOfString currencyDescription; // Create an instance of the service DynamicsGP wsDynamicsGP = new DynamicsGP(); // Be sure that default credentials are being used wsDynamicsGP.UseDefaultCredentials = true; // Create a context with which to call the service context = new Context(); // Set up the context context.OrganizationKey = null; // Create the criteria specifying which currencies to retrieve currencyCriteria = new CurrencyCriteria(); currencyDescription = new LikeRestrictionOfString(); currencyDescription.Like = "%Dollar%"; currencyCriteria.Description = currencyDescription; // Retrieve the list of currency objects currencyList = wsDynamicsGP.GetCurrencyList(currencyCriteria, context); // Display the number of currencies returned MessageBox.Show(currencyList.Length.ToString()); } } }
Native endpoint
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program { static void Main(string[] args) { Context context; Currency[] currencyList; CurrencyCriteria currencyCriteria; LikeRestrictionOfstring currencyDescription; // Create an instance of the service DynamicsGPClient wsDynamicsGP = new DynamicsGPClient(); // Create a context with which to call the service context = new Context(); // Set up the context context.OrganizationKey = null; // Create the criteria specifying which currencies to retrieve currencyCriteria = new CurrencyCriteria(); currencyDescription = new LikeRestrictionOfstring(); currencyDescription.Like = "%Dollar%"; currencyCriteria.Description = currencyDescription; // Retrieve the list of currency objects currencyList = wsDynamicsGP.GetCurrencyList(currencyCriteria, context); // Display the number of currencies returned MessageBox.Show(currencyList.Length.ToString()); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }