Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Description
Retrieves a list of payables document summary objects that match the specified criteria.
Parameters
Parameter |
Type |
Description |
|---|---|---|
criteria |
A payables document criteria object that specifies which payables document summary objects are returned. |
|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetPayablesDocumentListResult |
The list of payables document summary objects that match the specified criteria. |
Interfaces
- Dynamics GP
- Purchasing
Examples
The following C# example retrieves the list of payables document summary objects with a vendor Id of "ADVANCED0001" and a Type of "Invoice". The invoice date and invoice amount from each payables document summary object are 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)
{
CompanyKey companyKey;
Context context;
LikeRestrictionOfString vendorRestriction;
ListRestrictionOfNullableOfPayablesDocumentType typeRestriction;
PayablesDocumentCriteria documentCriteria;
PayablesDocumentSummary[] documentSummaries;
// 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 the restriction objects
// Retrieve payables documents for a specified vendor
vendorRestriction = new LikeRestrictionOfString();
vendorRestriction.EqualValue = "ADVANCED0001";
// Retrieve only invoice documents
typeRestriction = new ListRestrictionOfNullableOfPayablesDocumentType();
typeRestriction.EqualValue = PayablesDocumentType.Invoice;
// Create a payables document criteria object
documentCriteria = new PayablesDocumentCriteria();
documentCriteria.Type = typeRestriction;
documentCriteria.VendorId = vendorRestriction;
// Retrieve the payables document summary objects
documentSummaries = wsDynamicsGP.GetPayablesDocumentList(documentCriteria, context);
// Display the invoice date and amount for each member of the summary object list
StringBuilder summaryList = new StringBuilder();
foreach (PayablesDocumentSummary a in documentSummaries)
{
summaryList.AppendLine("Invoice date: " + a.Date.Value.ToShortDateString()
+ " Invoice Amount: " + a.DocumentAmount.Value.ToString("C"));
}
MessageBox.Show(summaryList.ToString());
}
}
}
** 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;
LikeRestrictionOfstring vendorRestriction;
ListRestrictionOfNullableOfPayablesDocumentType typeRestriction;
PayablesDocumentCriteria documentCriteria;
PayablesDocumentSummary[] documentSummaries;
// 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 the restriction objects
// Retrieve payables documents for a specified vendor
vendorRestriction = new LikeRestrictionOfstring();
vendorRestriction.EqualValue = "ADVANCED0001";
// Retrieve only invoice documents
typeRestriction = new ListRestrictionOfNullableOfPayablesDocumentType();
typeRestriction.EqualValue = PayablesDocumentType.Invoice;
// Create a payables document criteria object
documentCriteria = new PayablesDocumentCriteria();
documentCriteria.Type = typeRestriction;
documentCriteria.VendorId = vendorRestriction;
// Retrieve the payables document summary objects
documentSummaries = wsDynamicsGP.GetPayablesDocumentList(documentCriteria, context);
// Display the invoice date and amount for each member of the summary object list
StringBuilder summaryList = new StringBuilder();
foreach (PayablesDocumentSummary a in documentSummaries)
{
summaryList.AppendLine("Invoice date: " + a.Date.Value.ToShortDateString()
+ " Invoice Amount: " + a.DocumentAmount.Value.ToString("C"));
}
MessageBox.Show(summaryList.ToString());
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}