Use ClientID to control which account an object is associated with when using Marketing Cloud Engagement Enterprise, Enterprise 2.0, and Agency editions. To ensure the object is created in the right account, specify the client ID on all objects passed into the API.
When you provision an account through the API, you can set a PartnerKey for the account to identify it externally. Reference the PartnerKey in the ClientID object PartnerClientKey property. If you don’t associate PartnerKey with the account, use the ClientID objectID property with your account ID as the value.
Marketing Cloud Engagement maintains the PartnerClientKey property for legacy functionality and backwards compatibility. To avoid performance issues, don’t use this property in new code or integrations. Replace this property with ClientID whenever possible.
Sample .NET Code
These .NET code examples show how to use the ClientID in your code.
Authenticate to the SOAP API Using the Parent Account
1// Initialize the web service proxy2PartnerAPIWse integrationFramework = new PartnerAPIWse();3// Set the username/password. This is using the Username token of WS-Security 1.04UsernameTokenProvider utp = new UsernameTokenProvider("username", "password");5integrationFramework.SetClientCredential<UsernameToken>(utp.GetToken());6// Declare the policy7policy = new Policy(new UsernameOverTransportAssertion());8integrationFramework.SetPolicy(policy);9...
Create an Account with a Partner Key
1Account account = new Account();2account.Name = "Account " + name;3account.PartnerKey = "12345"; // partner key eases the management of sub-accounts4account.FromName = "Account " + name;
Create a ClientID
1ClientID clientId = new ClientID();2// Option #1 - Use Account ID3//clientId.ID = 12345;4//clientId.IDSpecified = true;5// Option #2 - Use the partner key you provided for the account6clientId.PartnerClientKey = "12345";7...
Create a List
1List list = new List();2list.Client = clientID; // The owner of the list3list.PartnerKey = "121245"; // Your identifier for the list4list.ListName = "Campaign 1";5list.Description = "Subscriber in Campaign 1";
Retrieve a List from a Specific Account
1ClientID rrclient = new ClientID();2rrclient.ID = 12345;3rrclient.IDSpecified = true;4rr.Options.Client = rrclient;5... // Retrive the list
or
1ClientID[] clients = new ClientID[1];2clients[0] = new ClientID();3clients[0].ID = 12345;4clients[0].IDSpecified = true;5rr.ClientIDs = clients;6... // Retrive the list
SOAP Envelopes
Use ClientID in your SOAP calls differently, depending on the method. In each of these examples, notice the unique placement and usage of the Client property in the SOAP body.