|
|
Documentation Wiki > Developer Documentation > Web Service Guide > Technical Articles > Adding a New User to an Existing Account
Adding a New User to an Existing AccountFrom $1Table of contents(Click the banner to go to the related Docs.Code.ExactTarget.com page.) This document contains conceptual and procedural information about adding new users to existing ExactTarget accounts. Why Add a New User to an Existing AccountAdding a new user to your existing account allows you to provide access to the account to a new person while also regulating what actions that user can perform. You can perform this action via the SOAP API to add new users to accounts owned by embedded partners, or you can use this code to add users from information taken from third-party sources, such as HR systems. You can find more information about the permissions assigned to users on the Users page. These permissions determine which actions a user can or cannot perform and what information they can view within an account. Be sure to have the correct username and password information for the new user for use in the creation process. Avoid using XML-sensitive characters such as #, ^, <, >, or & in the password. How to Add a New User to an Existing AccountUse the sample code below as a model for your API call. This sample code includes the required attributes for each user. Sample .NET Codepublic void testAddUserToAccount()
{
Account account = new Account()
Account.ID=12334
if (account != null)
{
AccountUser accountUser = new AccountUser();
accountUser.Name = "ACRUZ";
accountUser.UserID = "ACRUZ";
accountUser.IsAPIUser = true;
accountUser.IsAPIUserSpecified = true;
accountUser.IsLocked = false;
accountUser.IsLockedSpecified = true;
accountUser.Password = "XXX";
accountUser.MustChangePassword = false;
accountUser.MustChangePasswordSpecified = true;
accountUser.Email = "acruz@example.com";
UserAccess access = new UserAccess();
//3 CLIENT_ADMIN Add Users to Account
//4 PRO_ADMIN Create/View Accounts
access.ID = 3;
access.IDSpecified = true; //.Net specific
accountUser.UserPermissions = new UserAccess[] {access};
//This tells that create user in subaccount
ClientID clientID = new ClientID();
clientID.PartnerClientKey = "12345";
clientID.IDSpecified = true;
accountUser.Client = clientID;
APIObject[] apiObjects = {accountUser};
String requestId = null;
String overAllStatus = null;
CreateResult[] results = partnerAPIWse.Create(new CreateOptions(), apiObjects, out requestId, out overAllStatus);
if (results != null)
{
foreach (CreateResult result in results)
{
Console.WriteLine();
Console.WriteLine("Status Message ### " +
result.StatusMessage);
}
}
else
{
Console.Write("Error ...... ");
}
}
}
Sample Java Code (Axis 1.4)private CreateResponse createUserForThisAccount(Soap stub, Account account) throws java.rmi.RemoteException {
CreateRequest request;
APIObject[] apiObjects = null;
CreateResponse response;
AccountUser accountUser = new AccountUser();
accountUser.setUserID("AngelCruz");
accountUser.setPassword("XXX");
accountUser.setName("Angel Cruz");
accountUser.setEmail("acruz@example.com");
accountUser.setIsAPIUser(true);
accountUser.setIsLocked(false);
UserAccess access1 = new UserAccess();
access1.setID(23);
UserAccess access2 = new UserAccess();
access2.setID(3);
UserAccess access3 = new UserAccess();
access3.setID(25);
ClientID clientID = new ClientID();
clientID.setID(account.getID());
accountUser.setClient(clientID);
request = new CreateRequest();
apiObjects = new AccountUser[]{accountUser};
request.setObjects(apiObjects);
request.setOptions(new CreateOptions());
response = stub.create(request);
return response;
}
This page was last updated by Ryan Williams on Fri, 06 Jan 2012 21:25:12 GMT. If you require assistance with the ExactTarget application, please contact Global Support. If you wish to send Ryan direct feedback, fill out the form below:
Tags: (Edit tags)
|
Powered by MindTouch 2010 |