Permissions

Transfer of owner of files got not to be able to be used with batch requests of Drive API

At 15, June 2020, I have reported the transfer of owner of files got to be able to be achieved with batch requests of Drive API. Ref And also, yesterday (06, July 2020), I could have confirmed that this could be worked. But, now (07, July 2020), the following response is returned.

{
  "error": {
    "errors": [
      {
        "domain": "global",
        "reason": "invalidSharingRequest",
        "message": "Bad Request. User message: \"You can't yet change the owner of this item. (We're working on it.)\""
      }
    ],
    "code": 400,
    "message": "Bad Request. User message: \"You can't yet change the owner of this item. (We're working on it.)\""
  }
}

I hope this situation is resolved in the near future.

Transfer of owner of files got to be able to be achieved with batch requests of Drive API

Today, I could confirm that the transfer of owner of files got to be able to be achieved with batch requests of Drive API. When I had tested this at January 31, 2020, an error of there is no function to change the owner of this item yet (currently under development) had occurred.

But today, I could confirm that this got to be able to be achieved by the batch requests. By this, the owner of a lot of files can be transferred by reducing both the process cost and the quota cost.

Uploading CSV File as Spreadsheet and Modifying Permissions using Golang

Gists

This sample script is for uploading CSV file as Spreadsheet and modifying permissions using Golang.

I think that the detail information of google-api-go-client is a bit little. The sample scripts are so little. It retrieves most information from only godoc and GitHub. So I publish such sample scripts here. If this is useful for you, I’m glad.

Important points :

  1. Give mimeType of file that it wants to upload to options of Media(r io.Reader, options ...googleapi.MediaOption).
  2. In order to give options, use googleapi.ContentType().
  3. Give mimeType of file that it wants to convert, when it uploads it to Google Drive, to file of Create(file *File).
  4. In order to give file, use &drive.File{}.
  5. For installing permissions, use &drive.Permission{}. Each parameter is the same to them for Python.

This sample script uses Quickstart. So in order to use this sample script, at first, please do Step 1 and Step 2 of the Quickstart.