Undefined
Undefined

Reputation: 82

Google Drive revoke permissions on shared files

I want to revoke permissions on a shared file on my Google Drive Account.

 String fileId = "abc1234";
  String permissionId = "abc1234";
try 
{
  service.permissions().delete(fileId, permissionId).execute();
}//try
catch (IOException e) 
{
  System.out.println("An error occurred: " + e);
}//catch

I think the problem here might be the permissionId's value. Does anyone know how can get the right one? Also, is this the right way to revoke someone's permissions on a file?

Upvotes: 1

Views: 310

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116908

I would recommend doing a Permissions: list

service.permissions().list(fileId).execute();

This will return a list of the permission on the file in question. Then you can find the permission that you want to delete and run your delete on that.

Upvotes: 3

Related Questions