1
當我嘗試使用Google Drive .Net Api檢索元數據時,我能夠檢索文檔標題,但DownloadUrl for File是空的,因爲如果我上傳新文件,那麼它可用。DownloadUrl對於某些文件的文件爲空
這是我使用的代碼..
Try
Dim authenticator As IAuthenticator = TryCast(Session("authenticator"), IAuthenticator)
Dim service As DriveService = TryCast(Session("Service"), DriveService)
If authenticator Is Nothing OrElse service Is Nothing Then
Return Json("Failed Authenticator", JsonRequestBehavior.AllowGet)
End If
Dim file As Google.Apis.Drive.v2.Data.File = service.Files.Get(file_id).Fetch()
Return Json(file.DownloadUrl, JsonRequestBehavior.AllowGet)
Catch ex As Exception
Return Json(ex.Message, JsonRequestBehavior.AllowGet)
End Try