Lambda
Lambda

Reputation: 1640

Google Drive Api File Insert with convert Retrieve Second File ID

In C#, Google Drive API, While Inserting new file, with Forced conversion to Google doc format.

the API return the File ID of the newly converted and uploaded file.

But the API Also insert a copy of the original file non converted.

How do I get the file ID of the second file? the responsebody of request only return one file resource

FilesResource.InsertMediaUpload Request = Service.Files.Insert(body, Stream1, filetype);
Request.Convert = true;
Request.Upload();
Google.Apis.Drive.v2.Data.File File1 = Request.ResponseBody;

Upvotes: 0

Views: 668

Answers (3)

tushar
tushar

Reputation: 11

I am working on same.see the edit link for file https://docs.google.com/file/d/id of file/edit with no conversion

now for with conversion edit the file word from above link to document .it get worked for me. https://docs.google.com/document/d/id of file/edit

Upvotes: 1

MSD
MSD

Reputation: 322

I have never worked with converting files, so I am very curious about what you are saying here, and I am surprised that Files.Insert creates BOTH a converted version AND a "raw" version of the file, especially if it does not have some way to return the ID of the raw file to you.

How did you figure out that File.Insert creates two copies of the file when convert = true?

Upvotes: 0

Lambda
Lambda

Reputation: 1640

I could not find a way to retrieve the second "non converted" File ID. So a workaround is to upload in 2 steps: 1) Upload with conversion OFF, get first ID, 2) Copy newly uploaded file with conversion ON., Get second ID

Upvotes: 0

Related Questions