I want to share a document using the Goole Drive Api. Once I get a list of documents I don’t know how to share a document with one or more users.
EDIT:
Dim files As FileList = request.Fetch()
Dim oPermission As New Google.Apis.Drive.v2.Data.Permission
oPermission.Role = "reader"
oPermission.Type = "user"
oPermission.Value = "something@gmail.com"
Dim oPermissionResource As New Google.Apis.Drive.v2.PermissionsResource(service, auth)
For Each oFile As Google.Apis.Drive.v2.Data.File In files.Items
service.Permissions.Insert(oPermission, oFile.Id).Fetch()
Next
As @Ramhound pointed I was going the right way, I changed the code as in the example provided by @Ali Afshar. Now I’m getting an error:
Google.Apis.Requests.RequestError
Internal Error [500]
Errors [
Message[Internal Error] Location[ - ] Reason[internalError] Domain[global]
]
EDIT 2:
The error occurs when I set the permission role as owner. If i use other roles like reader, writer. The example works fine.
oPermission.Role = "owner" 'an error occurs
Does someone know what can cause the error in the example?
Thanks in advance.
Use the
permissions.insertmethod, there is an example for .Net in our examples section for that method.