尝试将组更新为另一个组的经理或所有者时,收到请求错误:
Google.GoogleApiException: Google.Apis.Requests.RequestError
Invalid Input: memberKey [400]
Errors [
Message[Invalid Input: memberKey] Location[ - ] Reason[invalid] Domain[global]
]
这可能是https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3791
中指出的服务问题我可以就此获得谷歌的官方消息吗? Provisioning API肯定支持它,API文档表明它可以通过https://developers.google.com/admin-sdk/directory/v1/guides/manage-group-members#json-response_2
中的响应来判断编辑:此代码演示错误:
DirectoryService service = AuthenticateService();
// Create a group which will contain our group as owner
var containerGroupRequest = service.Groups.Insert(new Group()
{
Name = "Stack Overflow Container Group",
Email = "test_container@" + domain,
Description = "Test Group, Please Ignore"
});
Group containerGroup;
try
{
containerGroup = containerGroupRequest.Execute();
Console.WriteLine("Container Group Created. Id: {0}", containerGroup.Id);
}
catch (Exception ex)
{
Console.WriteLine("Error occured creating group. Unable to continue. Exception: {0}", ex.ToString());
return;
}
// Create a group to use as an owner
var memberGroupRequest = service.Groups.Insert(new Group()
{
Name = "Stack Overflow Member Group",
Email = "test_member@" + domain,
Description = "Test Member Group, Please Ignore"
});
Group memberGroup;
try
{
memberGroup = memberGroupRequest.Execute();
Console.WriteLine("Member Group Created. Id: {0}", memberGroup.Id);
}
catch (Exception ex)
{
Console.WriteLine("Error occured creating group. Unable to continue. Exception: {0}", ex.ToString());
return;
}
Thread.Sleep(5000); // Give some time for things to update
// Add the member group to the container group as a member
var memberRequest = service.Members.Insert(new Member
{
Email = memberGroup.Email,
Role = "MEMBER"
}, containerGroup.Id);
Member member;
try
{
member = memberRequest.Execute();
Console.WriteLine("Member added to containerGroup. MemberId: {0}", member.Id);
}
catch (Exception ex)
{
Console.WriteLine("Adding member to container group failed. Error: {0}", ex.ToString());
return;
}
Thread.Sleep(5000); // Give some time for things to update
// Update the membership so the group is an owner
member.Role = "OWNER";
var ownerRequest = service.Members.Update(member, containerGroup.Id, member.Email);
Member owner;
try
{
owner = ownerRequest.Execute(); // <!-- This is where the 400 error occurs.
Console.WriteLine("Member updated to be owner. MemberId: {0}", owner.Id);
}
catch (Exception ex)
{
Console.WriteLine("Updating membership to ownership failed. Error: {0}", ex.ToString());
return;
}
它是输出:
Container Group Created. Id: 01ci93xb1y7qh7z
Member Group Created. Id: 04i7ojhp23eifv2
Member added to containerGroup. MemberId: 04i7ojhp23eifv2
Updating membership to ownership failed. Error: The service admin has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError
Invalid Input: memberKey [400]
Errors [
Message[Invalid Input: memberKey] Location[ - ] Reason[invalid] Domain[global]
]
at Google.Apis.Requests.ClientServiceRequest`1.Execute() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis\Apis\Requests\ClientServiceRequest.cs:line 96
at GOwnerFailTest.Program.GroupTest() in d:\Repo\GSync\GOwnerFailTest\Program.cs:line 103
答案 0 :(得分:0)
尽管配置API explicitly supported groups as other groups,支持群组作为其他群组所有者的官方消息是:
事情的真相是Directory API不允许设置 组作为其他组的所有者,Provisioning API已经 不推荐使用,管理控制台有一个仍然允许你的异常 将所有者角色分配给组。 Provisioning API未指定您 可以或应该将一个组指定为其他组的所有者。
文章中没有指定的细节总是很少。 虽然,我们努力改善我们的服务和 文档,总有人为因素。
非常不幸的是,你非常依赖这种异常 已被部分修复。
尽管我们多年来已成功使用超过30所学校的Google网上论坛,但这种功能的更改(有意或无意)意味着群组服务现在无法满足我们的要求。因此,我们正在将邮件组迁移到Office 365,这允许您至少通过PowerShell设置成员发布权限。
希望Google能够推出一个用于配置个人成员发布权限的API,这样我们就可以通过编程方式正确地授权我们的邮件组。