node-samples icon indicating copy to clipboard operation
node-samples copied to clipboard

V3 Upload to folder snippet parents value incorrect

Open cdgugler opened this issue 2 years ago • 0 comments

I wasn't able to get the v3 snippet to create a file in the a folder. According to the API docs the value for 'parents' in V3 is an array of strings. The sample snippet is still using the V2 format which was an array of 'parents Resource'.

This worked for me: const fileMetadata = { 'title': 'photo.jpg', 'parents': [folderId], };

https://github.com/googleworkspace/node-samples/blob/ed688637f3d416280b666c2ee4ca0b4f5af06abb/drive/snippets/drive_v3/file_snippets/upload_to_folder.js#L36

cdgugler avatar Jul 27 '22 19:07 cdgugler