0

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();
  • I am afraid I don't understand your question. What is wrong with your current code are you getting an error? – Linda Lawton - DaImTo Mar 09 '16 at 14:11
  • I do not receive any error, the problem I have is that making a user get added, does not have the department, and shipping this code: neworganitation.Primary = true; neworganitation.CustomType = ""; neworganitation.Department = Deparment; newuserbody.Organizations = neworganitation; – Luis Alfonso Portillo Torres Mar 09 '16 at 16:37

0 Answers0