2012-09-04 60 views
3

我想使用Goole Drive Api共享文檔。一旦我得到一份文件清單,我不知道如何與一個或多個用戶共享文件。如何在Google Drive中以VB或C共享文檔#

編輯:

Dim files As FileList = request.Fetch() 
Dim oPermission As New Google.Apis.Drive.v2.Data.Permission 
oPermission.Role = "reader" 
oPermission.Type = "user" 
oPermission.Value = "[email protected]" 
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 

正如@Ramhound指出我會以正確的方式,我改變了代碼由@Ali阿夫沙爾提供的例子。現在,我得到一個錯誤:

Google.Apis.Requests.RequestError 
Internal Error [500] 
Errors [ 
    Message[Internal Error] Location[ - ] Reason[internalError] Domain[global] 
] 

編輯2:

當我設置爲所有者許可角色出現的錯誤。如果我使用其他角色如閱讀器,作家。這個例子工作正常。

oPermission.Role = "owner" 'an error occurs 

有人知道什麼會導致例子中的錯誤?

在此先感謝。

+0

你確實是對的。繼續嘗試,然後發佈您的嘗試。一旦完成,請從Google Drive API發佈重要部分。 –

+0

感謝您的回覆,我更新和插入方法之間有點混淆。 – jsaye

回答

1

使用permissions.insert方法,對於該方法,我們的examples section中有一個.Net示例。

+0

我跟着你的例子,我得到一個錯誤,你知道什麼會導致這個錯誤?感謝您的回覆! – jsaye

相關問題