Compartilhar via


GetBusinessObjectSummaryList

Description

Retrieves a list of business object summary objects that match the specified criteria.

Parameters

Parameter

Type

Description

businessObjectTypeId

guid

Specifies the type of business object to be retrieved. Use the method GetUserAssignableBusinessObjectList to retrieve the list of available objects.

organizationKey

OrganizationKey

Specifies where the business object information should be retrieved from, such as a specific company.

criteria

BusinessObjectSummaryCriteria

The business object summary criteria object that specifies which business object summary objects are returned.

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetBusinessObjectSummaryListResult

ArrayOfBusinessObjectSummary

The list of business object summary 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 business object summary objects for each customer defined in the sample company. Notice how the GetUserAssignableBusinessObjectList method is used to retrieve the list of available business objects so the businessObjectTypeId can be set.

Cc508663.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;
            CompanyKey companyKey;
            Guid BusinessObjectType = new Guid();
            UserAssignableBusinessObject[] userAssignableBusinessObjects;
            BusinessObjectSummary[] businessObjectSummaryList;
            BusinessObjectSummaryCriteria businessObjectSummaryCriteria;

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

            // Set up the context object
            context.OrganizationKey = null;

            // Retrieve the list of user-assignable business objects
            userAssignableBusinessObjects = wsDynamicsGP.GetUserAssignableBusinessObjectList(context);

            // Find the type for Customer
            foreach (UserAssignableBusinessObject u in userAssignableBusinessObjects)
            {
                if (u.BusinessObjectTypeDisplayName == "Customer")
                {
                    BusinessObjectType = u.BusinessObjectTypeId;
                    break;
                }
            }

            // Search for customers in the sample company
            companyKey = new CompanyKey();
            companyKey.Id = (-1);

            // Update the context object for the call
            context.OrganizationKey = (OrganizationKey)companyKey;

            // Create the criteria to search -- No restrictions
            businessObjectSummaryCriteria = new BusinessObjectSummaryCriteria();

            // Get the list of business object summaries of the specified type
            businessObjectSummaryList = wsDynamicsGP.GetBusinessObjectSummaryList(BusinessObjectType,
            companyKey, businessObjectSummaryCriteria, context);

            // Display the details of the business object summaries in the list
            StringBuilder businessObjectList = new StringBuilder();
            foreach (BusinessObjectSummary b in businessObjectSummaryList)
            {
                // Build the string to display
                businessObjectList.AppendLine(b.DisplayName + "  " + b.DisplayId);
            }
            MessageBox.Show(businessObjectList.ToString());
        }
    }
}

Cc508663.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;
            CompanyKey companyKey;
            Guid BusinessObjectType = new Guid();
            UserAssignableBusinessObject[] userAssignableBusinessObjects;
            BusinessObjectSummary[] businessObjectSummaryList;
            BusinessObjectSummaryCriteria businessObjectSummaryCriteria;

            // 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 object
            context.OrganizationKey = null;

            // Retrieve the list of user-assignable business objects
            userAssignableBusinessObjects = wsDynamicsGP.GetUserAssignableBusinessObjectList(context);

            // Find the type for Customer
            foreach (UserAssignableBusinessObject u in userAssignableBusinessObjects)
            {
                if (u.BusinessObjectTypeDisplayName == "Customer")
                {
                    BusinessObjectType = u.BusinessObjectTypeId;
                    break;
                }
            }

            // Search for customers in the sample company
            companyKey = new CompanyKey();
            companyKey.Id = (-1);

            // Update the context object for the call
            context.OrganizationKey = (OrganizationKey)companyKey;

            // Create the criteria to search -- No restrictions
            businessObjectSummaryCriteria = new BusinessObjectSummaryCriteria();

            // Get the list of business object summaries of the specified type
            businessObjectSummaryList = wsDynamicsGP.GetBusinessObjectSummaryList(BusinessObjectType,
            companyKey, businessObjectSummaryCriteria, context);

            // Display the details of the business object summaries in the list
            StringBuilder businessObjectList = new StringBuilder();
            foreach (BusinessObjectSummary b in businessObjectSummaryList)
            {
                // Build the string to display
                businessObjectList.AppendLine(b.DisplayName + "  " + b.DisplayId);
            }
            MessageBox.Show(businessObjectList.ToString());

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