早上好 我使用“管理员SDK”在C#.Net中创建帐户,但在组织或地址发货时,如果创建但未添加用户但未添加此信息,请保留我正在使用的代码。
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();