GetCurrencyList


Description

Retrieves a list of currency objects that match the specified criteria.

Parameters

Parameter

Type

Description

criteria

CurrencyCriteria

The currency criteria object that specifies which currency objects are returned.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetCurrencyListResult

ArrayOfCurrency

The list of currency objects that match the specified criteria.


Interfaces

 

Examples

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();
		}
	}
}
}


Documentation Feedback