OneDrive / samples

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

Selecting from File Picker search results fails - Json is different #25

Closed capedrolima closed 1 year ago

capedrolima commented 1 year ago

Hey guys, we applied the feature related to the issue https://github.com/OneDrive/samples/issues/20. Many thanks for considering my request. The feature is really good.

But we realized that in my application I can only pick (select) just some files/folders from the search result. If navigating to a folder/file and selecting an item works fine. However, the Select button does not work when we search for an item and select it from the search results. The Select button greys out with a spinning icon for a few seconds and then displays again, but nothing happens. The item is not selected.

Below you can see a gif where I reproduced the problem: Test 1:

  1. Call the File Picker
  2. Navigate manually to the File that I want to attach (Site> Documents> Invitation> Invitation letter for dinner.docx)
  3. Check the File
  4. Click Select > Works Fine.

Test 2:

  1. Call the File Picker
  2. Type dinner in search. Press enter
  3. Check the file
  4. Click Select > Don't work. Select button greys out with a spinning icon for a few seconds and then displays again.

+Update: We realized that the problem is because some data is missing in the JSON when compared with the regular one. We need the ids (sharepointIds).

Could you help us with this?

Search - FilePicker

image

patrick-rodgers commented 1 year ago

@capedrolima Confirmed the behavior you are seeing, will follow up with engineering team. Hopefully a quick fix.

patrick-rodgers commented 1 year ago

Hi @capedrolima -

I've just learned from engineering that depending on the backend API used to load the information they only guarantee the following properties will exist:

{
  id,
  parentReference: {
    driveId
  },
  ‘@sharePoint.endpoint’
}

I am going to update the docs to reflect this (I also just learned this limitation) - but it likely will make sense to include a check if the information you want is present and if not make a request using the provided information.

Generally, the form would be:

@sharePoint.endpoint/drives/{driveId}/items/{id}

My testing ended up with something like:

https://{tenant}-my.sharepoint.com/_api/v2.0/drives/{drive id}/items/{id}

capedrolima commented 1 year ago

Hi @patrick-rodgers. Thanks for the feedback. I will follow up with my team here. I'll be back in case of problems. All the best!

patrick-rodgers commented 1 year ago

Updated docs are now live: https://learn.microsoft.com/en-us/onedrive/developer/controls/file-pickers/?view=odsp-graph-online#picked-item-results

Going to close this one, but do please let us know if you have any other questions/issues. Thanks!