Compartilhar via


GetUofMScheduleList

Description

Retrieves a list of unit of measure schedule summary objects that match the specified criteria.

Parameters

Parameter

Type

Description

criteria

UofMScheduleCriteria

A unit of measure schedule criteria object that specifies which unit of measure schedule summary objects are returned.

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetUofMScheduleListResult

ArrayOfUofMScheduleSummary

The list of unit of measure schedule summary objects that match the specified criteria.

Interfaces

  • Dynamics GP
  • Inventory

Examples

The following C# example retrieves the list of unit of measure schedule summary objects whose Unit of Measure Schedule Id begins with "A". A message box displays a list containing the ID and description of each unit of measure schedule.

Cc508550.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)
        {
            CompanyKey companyKey;
            Context context;
            UofMScheduleSummary[] unitSummary;
            UofMScheduleCriteria unitCriteria;
            LikeRestrictionOfString unitRestriction;

            // Create an instance of the service
            DynamicsGP wsDynamicsGP = new DynamicsGP();

            // Be sure the default credentials are used
            wsDynamicsGP.UseDefaultCredentials = true;

            // Create a context with which to call the service
            context = new Context();

            // Specify which company to use (sample company)
            companyKey = new CompanyKey();
            companyKey.Id = (-1);

            // Set up the context object
            context.OrganizationKey = (OrganizationKey)companyKey;

            // Create a restriction object
            // The "A%" matches all strings beginning with A
            unitRestriction = new LikeRestrictionOfString();
            unitRestriction.Like = "A%";

            // Create a criteria object
            // Retrieve summary objects that have a key beginning with "A"
            unitCriteria = new UofMScheduleCriteria();
            unitCriteria.UnitofMeasureScheduleId = unitRestriction;

            // Retrieve the records specified by the criteria object
            unitSummary = wsDynamicsGP.GetUofMScheduleList(unitCriteria, context);

            // Display a list of summary objects
            StringBuilder summaryList = new StringBuilder();
            foreach(UofMScheduleSummary a in unitSummary)
            {
                summaryList.AppendLine("ID:" + a.Key.Id + "  Description:" + a.Description);
            }
            MessageBox.Show(summaryList.ToString());
        }
    }
}

Cc508550.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)
        {
            CompanyKey companyKey;
            Context context;
            UofMScheduleSummary[] unitSummary;
            UofMScheduleCriteria unitCriteria;
            LikeRestrictionOfstring unitRestriction;

            // Create an instance of the service
            DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();

            // Create a context with which to call the service
            context = new Context();

            // Specify which company to use (sample company)
            companyKey = new CompanyKey();
            companyKey.Id = (-1);

            // Set up the context object
            context.OrganizationKey = (OrganizationKey)companyKey;

            // Create a restriction object
            // The "A%" matches all strings beginning with A
            unitRestriction = new LikeRestrictionOfstring();
            unitRestriction.Like = "A%";

            // Create a criteria object
            // Retrieve summary objects that have a key beginning with "A"
            unitCriteria = new UofMScheduleCriteria();
            unitCriteria.UnitofMeasureScheduleId = unitRestriction;

            // Retrieve the records specified by the criteria object
            unitSummary = wsDynamicsGP.GetUofMScheduleList(unitCriteria, context);

            // Display a list of summary objects
            StringBuilder summaryList = new StringBuilder();
            foreach(UofMScheduleSummary a in unitSummary)
            {
                summaryList.AppendLine("ID:" + a.Key.Id + "  Description:" + a.Description);
            }
            MessageBox.Show(summaryList.ToString());

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