List the permissions for a file by file id. (In this example the file id = 1R_70heIyzIAu1_u0prXbYcaIiJRVkgBl)
Dim rest As New Chilkat.Rest
Dim success As Boolean
' Provide a previously obtained OAuth2 access token.
Dim oauth2 As New Chilkat.OAuth2
oauth2.AccessToken = "OAUTH2_ACCESS_TOKEN"
rest.SetAuthOAuth2(oauth2)
success = rest.Connect("www.googleapis.com",443,True,True)
If (success <> True) Then
Debug.WriteLine(rest.LastErrorText)
Exit Sub
End If
rest.AddQueryParam("includeTeamDriveItems","true")
rest.AddQueryParam("supportsTeamDrives","true")
Dim sbJson As New Chilkat.StringBuilder
success = rest.FullRequestNoBodySb("GET","/drive/v3/files/1R_70heIyzIAu1_u0prXbYcaIiJRVkgBl/permissions",sbJson)
If (success <> True) Then
Debug.WriteLine(rest.LastErrorText)
Exit Sub
End If
If (rest.ResponseStatusCode <> 200) Then
Debug.WriteLine("Received error response code: " & rest.ResponseStatusCode)
Debug.WriteLine("Response body:")
Debug.WriteLine(sbJson.GetAsString())
Exit Sub
End If
Dim json As New Chilkat.JsonObject
json.LoadSb(sbJson)
' The following code parses the JSON response.
' A sample JSON response is shown below the sample code.
Dim kind As String
Dim i As Integer
Dim count_i As Integer
Dim id As String
Dim type As String
Dim role As String
Dim allowFileDiscovery As Boolean
kind = json.StringOf("kind")
i = 0
count_i = json.SizeOfArray("permissions")
While i < count_i
json.I = i
kind = json.StringOf("permissions[i].kind")
id = json.StringOf("permissions[i].id")
type = json.StringOf("permissions[i].type")
role = json.StringOf("permissions[i].role")
allowFileDiscovery = json.BoolOf("permissions[i].allowFileDiscovery")
i = i + 1
End While
Debug.WriteLine("Example Completed.")
{
"kind": "drive#permissionList",
"permissions": [
{
"kind": "drive#permission",
"id": "07604395918166943595k",
"type": "domain",
"role": "reader",
"allowFileDiscovery": false
},
{
"kind": "drive#permission",
"id": "05909037819814716957",
"type": "user",
"role": "organizer"
},
{
"kind": "drive#permission",
"id": "13254573739200948291",
"type": "user",
"role": "organizer"
}
]
}