I followed all the instructions
npm install @microsoft/microsoft-graph-client --save
npm install @microsoft/microsoft-graph-types --save-dev
then in code
import "isomorphic-fetch";
import { Client } from "@microsoft/microsoft-graph-client";
and
try {
const uploadTask: MicrosoftGraph.OneDriveLargeFileUploadTask =
await MicrosoftGraph.OneDriveLargeFileUploadTask.create(client, file, options);
const uploadedFile: DriveItem = await uploadTask.upload();
console.log(JSON.stringify(`Uploaded file with ID: ${uploadedFile.id}`));
return `Uploaded file with ID: ${uploadedFile.id}`;
} catch (err) {
console.log(`Error uploading file: ${JSON.stringify(err)}`);
return `Error uploading file: ${JSON.stringify(err)}`;
}
the TSLINT errors:"Cannot find namespace 'MicrosoftGraph'. ts(2503)"
Also, how do I get a Client object from props (MSGraphClientFactory) I get from the Web Part?
Thank you much