Google Apps Provisioning API を使用して Google アカウントを作成するために、.Net でコーディングを行いました。Google アカウントの作成には成功しましたが、特定の組織単位およびグループにユーザーを追加できません。次のようなアカウント作成の目標を達成しました。
//Creating Google Account
AppsService appService = new AppsService("Mydomain", "AdminUsername", "AdminPassword");
try
{
var account = appService.CreateUser(googleEmail, FirstName.Text, LastName.Text, password);
}
catch (Exception ex)
{
ResultsLabel.Text += "<br />Can't create this Google Account";
}
ユーザーが追加されると、Google のメイン ドメイン「ユーザー」の下に作成されます。しかし、そのユーザーを所属する組織単位に配置する必要があります。ここでは、ユーザーを「スタッフ」組織単位に配置する必要があります。applicationName の意味がわかりません。プロジェクト ソリューション名を使用しているだけですか、それともここで正しい名前を使用していませんか? applicatinName とは何を意味し、何を使用すればよいですか? ドメイン用に Google から取得した次のコードで、CustomerID を「GoogleCustomerId」として使用しています。組織単位にユーザーを追加するために機能しない次のようなコーディングを行いました。
//Adding User to Organization Unit
OrganizationService service = new OrganizationService("mydomain", "applicationName");
service.setUserCredentials("AdminUsername", "AdminPassword");
service.UpdateOrganizationUser("GoogleCustomerId", Email.Text, "Staff", "Users");
ユーザーを組織単位に追加する上記のコードでこの例外が発生します。
Google.GData.Client.GDataRequestException was unhandled by user code
HResult=-2146233088
Message=Execution of request failed: https://apps-apis.google.com/a/feeds/orguser/2.0/C090ll5hh/Test@domain.com
Source=Google.GData.Client
ResponseString=<?xml version="1.0" encoding="UTF-8"?>
<AppsForYourDomainErrors>
<error errorCode="1801" invalidInput="" reason="InvalidValue" />
</AppsForYourDomainErrors>
ユーザーをグループに追加するコードは次のとおりですが、機能していません。ユーザーをstaff@mydomain.comグループに追加する必要があります。
//Adding User to Group
service.Groups.AddMemberToGroup("staff@mydomain.com", username);
これについて何か考えはありますか?
ありがとう