Retrieves a list of receivables invoice summary objects that match the specified criteria.
Parameter |
Type |
Description |
---|---|---|
criteria |
A receivables invoice criteria object that specifies which receivables invoice summary objects are returned. |
|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetReceivablesInvoiceListResult |
The list of receivables invoice summary objects that match the specified criteria. |
The following C# example retrieves the list of receivables invoice summary objects with a SalespersonId of “Nancy B.“. A message box displays the number of receivables invoice summary objects that were retrieved.
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; LikeRestrictionOfString salespersonRestriction; ReceivablesInvoiceCriteria invoiceCriteria; ReceivablesInvoiceSummary[] invoiceSummaries; // 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 // Retrieve all receivables invoice objects for salesperson 'Nancy B.' salespersonRestriction = new LikeRestrictionOfString(); salespersonRestriction.EqualValue = "Nancy B."; // Create the receivables invoice criteria object invoiceCriteria = new ReceivablesInvoiceCriteria(); invoiceCriteria.SalespersonId = salespersonRestriction; // Retrieve the list of receivables invoice summary objects invoiceSummaries = wsDynamicsGP.GetReceivablesInvoiceList(invoiceCriteria, context); // Display the number of receivables invoice objects in the list MessageBox.Show("Total invoices for Nancy B.: " + invoiceSummaries.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) { CompanyKey companyKey; Context context; LikeRestrictionOfstring salespersonRestriction; ReceivablesInvoiceCriteria invoiceCriteria; ReceivablesInvoiceSummary[] invoiceSummaries; // 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 // Retrieve all receivables invoice objects for salesperson 'Nancy B.' salespersonRestriction = new LikeRestrictionOfstring(); salespersonRestriction.EqualValue = "Nancy B."; // Create the receivables invoice criteria object invoiceCriteria = new ReceivablesInvoiceCriteria(); invoiceCriteria.SalespersonId = salespersonRestriction; // Retrieve the list of receivables invoice summary objects invoiceSummaries = wsDynamicsGP.GetReceivablesInvoiceList(invoiceCriteria, context); // Display the number of receivables invoice objects in the list MessageBox.Show("Total invoices for Nancy B.: " + invoiceSummaries.Length.ToString()); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }