odedmoran
odedmoran

Reputation: 1

Is there a way to open a specific folder in OneDrive file picker for JavaScript v7.2?

I'm trying to use OneDrive file picker for JavaScript v7.2: https://learn.microsoft.com/en-us/onedrive/developer/controls/file-pickers/js-v72/open-file?view=odsp-graph-online

On filepicker window load, I get a list of my OneDrive files and folders, which include my RECORDINGS folder. I would like to achieve the following:

  1. Open this folder automatically on filepicker window load, instead of selecting it from the list of folders.
  2. Show recordings from teams tab chats (Sharepoint) and not only from chat tab (OneDrive).

I understand it might be possible by using the search items API (https://learn.microsoft.com/en-us/graph/api/driveitem-search?view=graph-rest-1.0&tabs=http), but I would like to save myself the effort of creating the filepicker's UI.

Thanks

Upvotes: 0

Views: 606

Answers (1)

Tim Cusick
Tim Cusick

Reputation: 1

Here is what we do. Below the option enpointHint receives the passed in link to the folder that you want to start in. (ie, https://sharepoint.com/sites/RECORDINGS)

  var odOptions = {
                clientId: "blah-blah-blah",
                action: "query",
                viewType: "files",
                multiSelect: true,
                advanced: {
                    isConsumerAccount: true,
                    endpointHint: PASSED_IN_LINK_TO_FOLDER,
                    navigation: {
                        disable: true
                    }
                },
                      
            };
            OneDrive.open(odOptions);

Upvotes: 0

Related Questions