1) You should check your user permissions as described here.
2) You can also double check this by replacing the parameters with actual values for an existing record (instead of creating dummy)
ClientID
PartnerClientKey
UserID
PartnerUserKey
CustomerKey
Set these in the code below and it should work if you've the appropriate permissions fixed.
public 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 = "[email protected]";
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 ...... ");
}
}
}