Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save files to OneDrive using Picker 8 #81

Open
shivani-cloudextend opened this issue Nov 5, 2024 · 2 comments
Open

Save files to OneDrive using Picker 8 #81

shivani-cloudextend opened this issue Nov 5, 2024 · 2 comments

Comments

@shivani-cloudextend
Copy link

shivani-cloudextend commented Nov 5, 2024

I am currently working on migrating the application from using Picker 7.2 to 8.
I would like to save the files to OneDrive using 8 like how it is done in 7.2

In 7.2, We followed this Doc to upload the file to Onedrive and it returns the metadata like itemId as the response.

In 7.2, once the file is selected, the OneDrive picker is opened and the location can be selected in Onedrive to save it.

We no longer see this functionality in version 8, Can we get a confirmation if it's a bug or is removed or any way to achieve this? We would also want the option of selecting multiple files and opening the OneDrive picker.

@shivani-cloudextend
Copy link
Author

Can I have an update over here

@ThomasMichon
Copy link

@shivani-cloudextend, the File Picker SDK 8.0 is admittedly a bit more of an "API" than a full SDK. The documentation for the File Picker 8.0 explains the new iframe-based contract, with instructions for how to load and set up communication with the File Picker.

To implement a "Save" flow, you will want to do the following:

  1. Specify "folder" picking mode.
  2. Specify "pick" selection mode.
  3. Update the button text and title to reflect the action taken.
filePicker={
  ...,
  "typesAndSources": {
    "mode": "folders"
  },
  "selection": {
    "mode": "pick"
  },
  "commands": {
    "pick": {
      "label": "Save"
    }
  },
  "title": ____
  ...
}

When you do this, the user will be prompted to choose a folder. The Picker will return the metadata for the chosen folder. Once you have this, you can use the Microsoft Graph API to perform whatever operation you like into that folder. For Save, that's usually performing a Resumable File Upload given a File or Blob.

You are correct that the File Picker 8.0 "SDK" no longer builds-in functionality related to what happens with the chosen file; that is for you to implement in your app, employing other SDKs as you see fit. For example, there exist SDK wrappers around the Graph API to facilitate further operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants