googleapis / googleapis/google-api-nodejs-client

Docs on developers.google.com are out of date for Google Drive

Open
#1,885 14 comments 4 reactions 0 assignees View on GitHub
api: drive external type: docs
Dominant language
TypeScript
Stars
12.2k
Forks
2k
Avg merge
1d 9h
Merged PRs (30d)
24

Description

#### Environment details
- OS: Windows 10
- Node.js version: 10.16.0
- npm version: 6.9.0
- `googleapis` version: 45.0.0

I'm trying to import a PowePoint file to Google Drive as a Google Docs document (see [https://developers.google.com/drive/api/v3/manage-uploads#import_to_google_docs_types_](https://developers.google.com/drive/api/v3/manage-uploads#import_to_google_docs_types_)), but
`drive.files.create` doesn't accept the resource option. When I try to pass `fileMetadata` as:
```
const fileMetadata = {
name: 'PowerPoint_test',
mimeType: 'application/vnd.google-apps.presentation'
};

const media = {
mimeType: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
body: fs.createReadStream('files/test.ppt')
};

drive.files.create({
resource: fileMetadata,
media: media,
fields: 'id'
}, (err, file) => {
if (err) {
// Handle error
console.error(err);
} else {
console.log('File Id:', file.id);
}
});
```

it shows an error:
```
Object literal may only specify known properties, and 'resource' does not exist in type 'Params$Resource$Files$Create'.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.