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
This method creates a new vendor address.
Parameters
Parameter |
Type |
Description |
|---|---|---|
address |
The vendor address object being created. |
|
context |
Specifies information about how the method will be called. |
|
policy |
Specifies the set of behaviors and behavior options to be applied during the operation. |
Interfaces
- Dynamics GP
- Purchasing
Examples
The following C# example creates a vendor address with the key value "PRIMARY" for the vendor with a vendor key of "NEWVNDR001". "NEWVNDR001" is the vendor created by the CreateVendor example. The Line1, City and State properties are set, and all other properties are left as default values.
** Legacy endpoint**
using System;
using System.Collections.Generic;
using System.Text;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
Policy vendorPolicy;
VendorAddressKey vendorAddressKey;
VendorAddress vendorAddress;
VendorKey vendorKey;
// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();
// Be sure the default credentials are being used
wsDynamicsGP.UseDefaultCredentials = true;
// Create a context object 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 vendor key object and populate the Id property
vendorKey = new VendorKey();
vendorKey.Id = "NEWVNDR001";
// Create a vendor address key
vendorAddressKey = new VendorAddressKey();
vendorAddressKey.Id = "PRIMARY";
vendorAddressKey.VendorKey = vendorKey;
// Create a vendor address object
vendorAddress = new VendorAddress();
vendorAddress.Key = vendorAddressKey;
vendorAddress.Line1 = "100 Main St.";
vendorAddress.City = "Orinoco";
vendorAddress.State = "MN";
// Create a policy object
vendorPolicy = wsDynamicsGP.GetPolicyByOperation("CreateVendorAddress", context);
// Create the vendor address
wsDynamicsGP.CreateVendorAddress(vendorAddress, context, vendorPolicy);
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
Policy vendorPolicy;
VendorAddressKey vendorAddressKey;
VendorAddress vendorAddress;
VendorKey vendorKey;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Create a context object 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 vendor key object and populate the Id property
vendorKey = new VendorKey();
vendorKey.Id = "NEWVNDR001";
// Create a vendor address key
vendorAddressKey = new VendorAddressKey();
vendorAddressKey.Id = "PRIMARY";
vendorAddressKey.VendorKey = vendorKey;
// Create a vendor address object
vendorAddress = new VendorAddress();
vendorAddress.Key = vendorAddressKey;
vendorAddress.Line1 = "100 Main St.";
vendorAddress.City = "Orinoco";
vendorAddress.State = "MN";
// Create a policy object
vendorPolicy = wsDynamicsGP.GetPolicyByOperation("CreateVendorAddress", context);
// Create the vendor address
wsDynamicsGP.CreateVendorAddress(vendorAddress, context, vendorPolicy);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}