Google Apps Provisioning API를 사용하여 Google 계정을 만들려면 .NET에서 코딩을 완료했습니다. Google 계정을 만들었지 만 특정 조직 단위 및 그룹에 사용자를 추가 할 수 없습니다. 나는 다음과 같이 계정 생성의 목표를 달성했다 :Google Apps 프로비저닝 API를 사용하여 조직 단위 및 그룹에 사용자 추가
//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/[email protected]
Source=Google.GData.Client
ResponseString=<?xml version="1.0" encoding="UTF-8"?>
<AppsForYourDomainErrors>
<error errorCode="1801" invalidInput="" reason="InvalidValue" />
</AppsForYourDomainErrors>
이 내 코드 그룹에 사용자를 추가 할뿐만 아니라 작동하지 않습니다, 나는 [email protected] 그룹에 사용자를 추가해야합니다
//Adding User to Group
service.Groups.AddMemberToGroup("[email protected]", username);
이 하나 제발 어떤 생각을?
감사합니다.
제안 주셔서 감사합니다 VicTheMagician. 곧 살펴보아야하지만 SDK의 구현은 어떻게되어 있습니까? Google Apps Provisioning API와 동일합니까? – TechPro
구현과 관련하여 몇 가지 차이점이 있습니다. 새로운 기능에서는 NuGet Manager를 통해 원하는 모든 클래스를 Visual Studio에 추가해야합니다. 그런 다음 코드에서 참조 할 수 있습니다 (예 : "Google.Apis 사용"). – VicTheMagician