OneDrive / samples

Contains samples, scenarios, and guidance for integrating with OneDrive and SharePoint drives, drive items, and files.
MIT License
49 stars 48 forks source link

FilePicker v8, consumer, does not honour entry.oneDrive.files.folder #36

Closed jonathon-love closed 1 year ago

jonathon-love commented 1 year ago

hi,

when using the FilePicker v8 against live.onedrive.com, it does not honour the start directory. i.e. the value set in:

.entry.oneDrive.files.folder (as taken from here: https://learn.microsoft.com/en-us/onedrive/developer/controls/file-pickers/v8-schema )

i have no trouble setting the start directory when accessing share points, but it looks like it doesn't work against live.onedrive.com

jonathon-love commented 1 year ago

i.e. this won't begin the picker in the Documents folder

    const options: IFilePickerOptions = {
        sdk: '8.0',
        entry: {
            oneDrive: { files: { folder: 'Documents' } },
        },
        // Applications must pass this empty `authentication` option in order to obtain details item data
        // from the picker, or when embedding the picker in an iframe.
        authentication: {},
        messaging: {
            origin: window.location.origin,
            channelId: channelId,
        },
...
patrick-rodgers commented 1 year ago

As shown in the schema comments this requires the full site-relative path to the folder:

entry: {
    oneDrive: {
        files: {
            folder: "/personal/{user OneDrive path}/documents/myfolder"
        },
    }
},
jonathon-love commented 1 year ago

yeah, the schema docs suggest i can use Pictures, which makes me think i can use Documents too.

         files?: {
            /**
             * Path segment for sub-folder within the user's OneDrive.
             * @example
             *  'Pictures'
             * @example
             *  '/personal/user_contoso_com/Documents/Attachments'
             */
            folder?: string;
         }

i think i may have become muddled in my original issue ... because i am having a lot of difficulty with setting the start directory with sharepoints too. i'll sit down and systematically work my through all the examples in the schema, and catalog which work, and which don't, and come back to you.

kind regards

jonathon-love commented 1 year ago

incidentally, for this: "/personal/{user OneDrive path}/documents/myfolder"

how does one resolve {user OneDrive path} for a onedrive.live.com user?

whenever a non-onedrive.live.com user interacts with the picker, the returned objects contain things as per the docs, i.e. /personal/user_contoso_com/Documents/Attachments ... however, onedrive.live.com user's return objects just contain a lot of IDs, and i haven't been able to find a way to resolve these IDs into something that

        entry: {
            oneDrive: { files: { folder: 'Documents' } },
        },

will use.

any tips?

jonathon-love commented 1 year ago

this was marked with status: answered, so it might be being neglected because of that. i will close.