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

File Picker - Cannot select file in designated SharePoint folder #78

Open kpoimenidis opened 4 months ago

kpoimenidis commented 4 months ago

Describe the bug In the File Picker, providing a path in typesAndSources.locations.sharePoint.folder disables file selection.

To Reproduce Steps to reproduce the behavior: Use the following File Picker configuration for entry, selection and typesAndSources.

{
  sdk: "8.0",
  entry: {
    sharePoint: {
      byPath: {
        web: "/sites/<site_name>",
        list: "/sites/<site_name>/Shared Documents",
        folder: "/sites/<site_name>/Shared Documents/<folder_name>",
        fallbackToRoot: true,
      },
    },
  },
  selection: {
    mode: "single",
    maximumCount: 1,
    enablePersistence: false,
  },
  typesAndSources: {
    mode: "all",
    locations: {
      sharePoint: {
        byPath: {
          web: "/sites/<site_name>",
          list: "/sites/<site_name>/Shared Documents",
          folder: "/sites/<site_name>/Shared Documents/<folder_name>",
        },
      },
    },
  },
}

Expected behavior I would expect:

Screenshots Screenshot 2024-06-28 at 1 35 01 PM

Details Please provide details around your solution, what you are trying to achieve with our shared controls, and where you believe the bug exists. The more details you can share the easier it is for us to investigate the issue. Thanks! What I am trying to achieve is to allow a user to select a file from a Teams channel, which translates to /sites/Shared Documents/General for the sharepoint path.

Providing the sharePoint.byPath configuration from above, the file picker opens at the correct location and the user is restricted to that folder and deeper, but the files are all disabled.

Additional context The full configuration.

{
  sdk: "8.0",
  entry: {
    sharePoint: {
      byPath: {
        web: "/sites/<site_name>",
        list: "/sites/<site_name>/Shared Documents",
        folder: "/sites/<site_name>/Shared Documents/<folder_name>",
        fallbackToRoot: true,
      },
    },
  },
  selection: {
    mode: "single",
    maximumCount: 1,
    enablePersistence: false,
  },
  typesAndSources: {
    mode: "all",
    locations: {
      sharePoint: {
        byPath: {
          web: "/sites/<site_name>",
          list: "/sites/<site_name>/Shared Documents",
          folder: "/sites/<site_name>/Shared Documents/<folder_name>",
        },
      },
    },
  },
  leftNav: {
    enabled: false,
  },
  messaging: {
    origin: location.origin,
    channelId: CHANNEL_ID,
  },
  list: {
    layout: {
      type: "compact-details",
    },
    scrolling: {
      enableStickyHeaders: true,
    },
  },
  commands: {
    upload: {
      enabled: false,
    },
    browseThisDevice: {
      enabled: false,
    },
    fromALink: {
      enabled: false,
    },
    switchAccount: {
      mode: "none",
    },
    manageAccounts: {
      mode: "none",
    },
    createFolder: {
      enabled: false,
    },
  },
}