C# Google Drive APIv3 Upload File

后端 未结 4 1634
攒了一身酷
攒了一身酷 2021-01-12 19:57

I\'m making a simple Application that Links to a Google Drive Account and then can Upload Files to any Directory and respond with a (direct) download Link. I already got my

4条回答
  •  执念已碎
    2021-01-12 20:28

    If you've followed Google Drive API's .NET Quickstart guide, then you probably remember during first launch, a web page from google drive was prompting for authorization grant to access google drive with "Read only" permission?

    The default scope "DriveService.Scope.DriveReadonly" from the quickstart guide can't be used if you intend on uploading files.

    This worked for me

    1. Remove "Drive ProtoType" from Apps connected to your account

    2. Create another set of credentials with a new application name eg "Drive API .NET Quickstart2" in API Manager

    3. Request access with this scope "DriveService.Scope.DriveFile" private static readonly string[] Scopes = { DriveService.Scope.DriveReadonly }; private static readonly string ApplicationName = "Drive API .NET Quickstart2";}

    4. You should land on a new page from google drive requesting new grant

      Drive Prototype would like to: View and manage Google Drive files and folders that you have opened or created with this app

    After allowing access, your application should be able to upload.

提交回复
热议问题