Good morning I am using the "admin SDK" for creating accounts in C # .Net, but at the time of shipment of the organization or address does not add the user if created but does not add this information, leave the code I'm using.
var service1 = new DirectoryService (new BaseClientService.Initializer ()
{
HttpClientInitializer = credentials,
ApplicationName = strApplicationName,
ApiKey = strApiKey
});
Console.Write("Email: ");
string userId = Console.ReadLine();
Console.Write("Givenname: ");
string GivenName = Console.ReadLine();
Console.Write("Familyname: ");
string FamilyName = Console.ReadLine();
Console.Write("Password: ");
string Password = Console.ReadLine();
Console.Write("Deparment: ");
string Deparment = Console.ReadLine();
User newuserbody = new User();
UserName newusername = new UserName();
UserOrganization neworganitation = new UserOrganization();
//---------------------------------------------
newusername.GivenName = GivenName;//First Name
newusername.FamilyName = FamilyName;//Last Name
newuserbody.Name = newusername;
//---------------------------------------------
newuserbody.PrimaryEmail = userId;//Email Address
newuserbody.Password = Password;
//--------------------------------------------
neworganitation.Primary = true;
neworganitation.CustomType = "";
neworganitation.Department = Deparment;
newuserbody.Organizations = neworganitation;
User results = service1.Users.Insert(newuserbody).Execute();