Compartilhar via


GetCurrencyAccessList

Description

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

Parameters

Parameter

Type

Description

criteria

CurrencyAccessCriteria

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

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetCurrencyAccessListResult

ArrayOfCurrencyAccess

The list of currency access objects that match the specified criteria.

Interfaces

  • Dynamics GP
  • Common
  • Field Service
  • Financials
  • Human Resources/Payroll
  • Inventory
  • Manufacturing
  • Project Accounting
  • Purchasing
  • Sales

Examples

The following C# example retrieves a list of the currency access objects for the sample company (with -1 as the ID value). The total number of objects returned is displayed in a message box.

Cc508461.LegacyEndpoint(en-us,MSDN.10).gif** 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;
            CurrencyAccessCriteria currencyAccessCriteria;
            CurrencyAccess[] currencyAccessList;
            BetweenRestrictionOfNullableOfInt32 companyRestriction;

            // 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 currency access criteria object, specifying
            // which company will be examined
            currencyAccessCriteria = new CurrencyAccessCriteria();
            companyRestriction = new BetweenRestrictionOfNullableOfInt32();
            companyRestriction.EqualValue = (-1);
            currencyAccessCriteria.CompanyId = companyRestriction;

            // Retrieve the currency access objects for the company
            currencyAccessList = wsDynamicsGP.GetCurrencyAccessList(currencyAccessCriteria, context);

            // Display the number of objects returned
            MessageBox.Show(currencyAccessList.Length.ToString());
        }
    }
}

Cc508461.NativeEndpoint(en-us,MSDN.10).gif** Native endpoint **

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            Context context;
            CurrencyAccessCriteria currencyAccessCriteria;
            CurrencyAccess[] currencyAccessList;
            BetweenRestrictionOfNullableOfint companyRestriction;

            // 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 currency access criteria object, specifying
            // which company will be examined
            currencyAccessCriteria = new CurrencyAccessCriteria();
            companyRestriction = new BetweenRestrictionOfNullableOfint();
            companyRestriction.EqualValue = (-1);
            currencyAccessCriteria.CompanyId = companyRestriction;

            // Retrieve the currency access objects for the company
            currencyAccessList = wsDynamicsGP.GetCurrencyAccessList(currencyAccessCriteria, context);

            // Display the number of objects returned
            MessageBox.Show(currencyAccessList.Length.ToString());

            // Close the service
            if(wsDynamicsGP.State != CommunicationState.Faulted)
            {
                wsDynamicsGP.Close();
            }
        }
    }
}