本文整理了Java中com.google.api.services.drive.Drive.permissions()
方法的一些代码示例,展示了Drive.permissions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drive.permissions()
方法的具体详情如下:
包路径:com.google.api.services.drive.Drive
类名称:Drive
方法名:permissions
[英]An accessor for creating requests from the Permissions collection.
The typical use is:
Drive drive = new Drive(...); Drive.Permissions.List request = drive.permissions().list(parameters ...)
[中]用于从权限集合创建请求的访问器。
典型用途是:
Drive drive = new Drive(...); Drive.Permissions.List request = drive.permissions().list(parameters ...)
代码示例来源:origin: io.github.aktoluna/slnarch-common
public void shareFile(File file, String to) throws IOException {
BatchRequest batch = drive.batch();
Permission userPermission = new Permission()
.setType("user")
.setRole("writer")
.setValue(to);
drive.permissions().insert(file.getId(), userPermission)
.setSendNotificationEmails(true)
.setFields("id")
.queue(batch, callback);
batch.execute();
}
代码示例来源:origin: qaprosoft/zafira
public void shareFile(String fileId, GranteeType granteeType, GranteeRoleType granteeRoleType, String email)
{
BatchRequest batch = new BatchRequest(getHttpTransport(), (HttpRequestInitializer) driveService.getGoogleClientRequestInitializer());
Permission userPermission = new Permission()
.setType(granteeType.getValue())
.setRole(granteeRoleType.getValue())
.setEmailAddress(email);
try
{
driveService.permissions().create(fileId, userPermission)
.setFields("id")
.queue(batch, new GoogleDriveJsonBatchCallback<Permission>());
batch.execute();
} catch (IOException e)
{
LOGGER.error(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!