AdminDirectory.Users.undelete(resource, userKey)UserKey是UserID/UserKey。不知道这里的资源是什么。
发布于 2020-01-06 13:01:11
答案:
https://developers.google.com/admin-sdk/directory/v1/reference/users/undelete所需的唯一参数是orgUnitPath__。
更多资料:
根据文件:
在请求主体中,提供具有以下结构的数据:
{
"orgUnitPath": string
}其中,orgUnitPath是您希望将用户还原到的组织单元的路径。您可以从同一个API的Orgunits: list9v)方法中获得组织单元的列表。
orgUnitPath参数需要在/之前加上一个/,按照Orgunits上的资源表示文档:
orgUnitPath:组织单元的完整路径。
orgUnitPath是一个派生属性。上市时,它是从parentOrgunitPath和组织单位的name派生出来的。例如,对于父组织'apps'下的一个名为orgUnitPath的组织单元,orgUnitPath是'/engineering/apps'。为了编辑orgUnitPath,要么更新组织的名称,要么更新parentOrgunitPath。
因此,对于这个示例,您需要提供以下资源:
{
"orgUnitPath": "/engineering/apps"
}要记住的事情:
当删除用户时,与delete方法不同,不能在字段中指定他们的电子邮件地址来还原他们。--这在undelete文档中有提到:
userKey:标识API请求中的用户。值必须是用户唯一的用户ID.
代码示例:
function undeleteUser() {
AdminDirectory.Users.undelete(
{
orgUnitPath: '/My-Org-Unit-Path'
},
'21-character-unique-user-id'
);
}可以从Users: list请求获得唯一的用户ID。
参考文献:
https://stackoverflow.com/questions/59597891
复制相似问题