Share via

How can the embedded OneDrive File Picker handle lots of pre-selected source items?

Tanner Driggers 20 Reputation points
2026-02-20T22:10:40.0333333+00:00

We have implemented an HTML OneDrive v8 File Picker according to the docs by embedding an iFrame on the page with the end of the URL being _layouts/15/FilePicker.aspx and the configurations added as a filePicker search parameter. One of the configurations is selections.sourceItems (documentation) which takes an array of pre-selected drive items so that they will show up already selected in the file picker.

The issue is, whenever more than a few items are passed as sourceItems, the picker frame never loads, the FilePicker.aspx POST request returns with an empty 200 response, and then another duplicate retry request is made which returns a 404 status and again no response data as seen in this screenshot: Screenshot 2026-02-20 at 4.00.17 PM

Because this pre-selected drive items functionality works when only a couple drive items are passed as sourceItems, that leads me to believe this is an issue with the URL being too long.

Could this be a defect with this version (v8) of the file picker or is there something else that can be done to get around this limitation?

I have tried the following to no avail:

  • Encoding the filePicker configuration URL search parameter
  • Moving the filePicker configurations to the body of the post request
  • Shrinking down the passed-in drive item source items so they only contain the sharepointIds attribute inside of them since that's all that seems to matter to the file picker
Microsoft 365 and Office | Development | Office JavaScript API
0 comments No comments
{count} votes

Answer accepted by question author
  1. FIRAT BOYAN 380 Reputation points Microsoft External Staff
    2026-02-20T23:33:03.89+00:00

    This behaviour is not a defect in File Picker v8 itself. What you are encountering is a practical request size limitation caused by how the picker configuration is transmitted to FilePicker.aspx.

    When you embed the picker using:

    _layouts/15/FilePicker.aspx?filePicker=...

    the entire configuration object, including selections.sourceItems, is serialised and passed through the query string or POST payload. Even if you move the configuration to the POST body, SharePoint Online still applies request size and URL length constraints at the front door layer.

    When the configuration becomes too large, SharePoint may return an empty 200 response followed by a retry that results in 404. This is typical behaviour when the request exceeds internal processing thresholds.

    Key point

    selections.sourceItems is not designed to handle large collections. It is intended for pre selecting a small number of items, not bulk initialisation.

    Why shrinking to sharepointIds does not help

    Even if you reduce each item to sharepointIds only, the JSON payload still grows linearly with item count. Once the serialised configuration crosses the internal limit, the picker initialisation fails before rendering.

    Recommended architectural approach

    Instead of passing a large array into selections.sourceItems, use one of the following patterns.

    Option 1. Pre filter using entry context

    If your goal is to open the picker within a specific folder or document library, use the entry configuration to scope the picker to a known location rather than pre selecting every item.

    Let the picker load the container and rely on user interaction or client side highlighting after load.

    Option 2. Store selection server side

    Persist the list of selected item IDs server side or in your application state.

    Load the picker without large sourceItems.

    After the picker loads, use Microsoft Graph to compare the user’s new selection against your stored selection set. Do not attempt to render all pre selections inside the picker UI.

    Option 3. Chunking strategy

    If you must pre select items, limit selections.sourceItems to a very small number such as fewer than twenty items. The picker is optimised for interactive selection, not mass pre selection.

    Option 4. Custom picker experience

    If your scenario requires hundreds of items to be pre selected visually, the embedded File Picker is not the correct control. You should build a custom selection experience using Microsoft Graph and a virtualised grid component where you control rendering and state management.

    Conclusion

    This is not a bug in version v8. It is a request size and design limitation of passing large serialised configuration objects into FilePicker.aspx.

    The correct design is to avoid sending large sourceItems arrays and instead manage large selection sets outside of the picker initialisation flow.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.