When I am trying to retrieve metadata using Google Drive .Net Api , I am able to retrieve Document Title but DownloadUrl for File is empty , whereaas if I upload a new file then its available.
This is the Code I am using..
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
Documents in Google native formats do not include a
downloadUrl, for them you should use theexportLinkscollection instead.For more details on how to download files from Drive, please check the documentation at https://developers.google.com/drive/manage-downloads