OneDrive / onedrive-api-docs

Official documentation for the OneDrive API
MIT License
447 stars 228 forks source link

Cannot embed Picker oneDrive in react.js, using v7.2 #1804

Open sarobidygmail12 opened 3 weeks ago

sarobidygmail12 commented 3 weeks ago

Category

My config :

React https://js.live.net/v7.2/OneDrive.js

i init it with this code :

var launchOneDrivePicker = function (oneDriveApplicationId: string) {
    return new Promise(function (resolve, reject) {
      var odOptions: any = {
        clientId: oneDriveApplicationId,
        multiSelect: true,
        action: 'download',
        openInNewWindow: true,
        advanced: {
          redirectUri: 'http://localhost:3000',
          scopes: 'Files.ReadWrite.All',
          queryParameters:
            'select=id,name,size,file,folder,photo,@microsoft.graph.downloadUrl',
          filter:
            'folder,.png,.jpeg,.jpg' /* display folder and files with extension '.png' only */,
          accessToken:
            ' TOKEN_HERE',
          endpointHint: 'https://contoso.sharepoint.com/shared%20documents/',
        },
        success: function (files: any) {
          console.log('success');
        },
        cancel: function () {
          console.log('cancel');
        },
        error: function () {
          console.log('error');
        },
      };
      window.OneDrive.open(odOptions);
    });
  };

But when call the function launchOneDrivePicker with a button no thing happen no error no newWindow so i use good Token that i echeive use microsoft auth

I followed the documentation how to do it, but it still doesn't work : https://learn.microsoft.com/en-us/onedrive/developer/controls/file-pickers/?view=odsp-graph-online

Somme can give me a help