M365 OneDrive Library Viewer Component

Estimated reading: 7 minutes

M365 OneDrive Library Viewer Component

M365 OneDrive Library Viewer lets users browse, search, open, download, and upload files in a Microsoft OneDrive library from a Salesforce Lightning page. Its Lightning Web Component name is msOneDriveLibViewer.

Configuration

Prepare the component and connection

Add M365 OneDrive Library Viewer to a Lightning page using Adding a Custom Component. Complete CloudTools license registration and configure a Microsoft 365 connector. Users with CloudTools Admin or CloudTools Super User can open the settings gear; users with CloudTools User can use the configured viewer.

The connector’s authorization method determines how the library is selected:

  • OAuth Delegated (Authorization Code): Opens the signed-in Microsoft user’s default OneDrive. The configured User Id or Email does not switch the viewer to another person’s drive.
  • OAuth Application (Client Credentials): Opens the default OneDrive of the user identified by User Id or Email, using the application’s granted permissions.

The target user must have an available OneDrive library. CloudTools permission sets control access to the component; Microsoft permissions control which file operations can succeed.

Choose the settings

SettingDefaultEffect on usage
ConnectorDefault Connector.Selects the Microsoft 365 connection. Default lookup prefers the connector marked for Flow automation, then the oldest matching connector. Select an explicit connector when several exist.
User Id or Email{UserEmail}Identifies the drive owner for application authorization. Use an Entra user ID or Microsoft user principal name, typically an email-formatted sign-in name. Delegated authorization uses the signed-in Microsoft user’s drive instead.
Top Query100.Sets the number of items requested from Microsoft for a folder listing or search. Use a positive whole number. This is a retrieval setting, not the number of rows on each displayed page.
Order Byname ascControls sorting. For example, name desc reverses alphabetical order and lastModifiedDateTime desc puts recently modified items first. When folders are included, the viewer groups them before files.
Include FoldersEnabled.Shows folder entries alongside files. Turning it off hides folders from listings and search results, preventing navigation through those folder entries. It does not flatten all subfolder files into the current folder.
Display Limit10.Sets the number of returned items displayed per page and helps size the scrollable list. Use a positive whole number. Previous and Next move through the items already loaded.

For example, Top Query of 100 and Display Limit of 10 requests up to the configured result size and displays the returned items in pages of ten. Folder filtering can reduce the visible count. Increasing Display Limit does not retrieve additional items from Microsoft, and the page count describes the loaded results rather than the entire library.

Use replacement tokens

For application connections, {UserEmail} uses the Salesforce viewer’s email to identify the drive owner. It must match the Microsoft sign-in name. A fixed Entra user ID or a record field token such as {Record.Entra_User_ID__c} can identify a different owner; replace the example with your actual field API name.

Record tokens require a current record and readable fields. A Home or app page normally has no record context. Tokens select values, not permissions, and they do not change the signed-in account for delegated connections. See Configuring a Custom Component for replacement-token guidance.

Save or reset configuration

  • Apply: Saves your personal configuration, clears the current search and folder navigation, checks authorization, and loads the library from Root.
  • Apply to Default: Saves the shared fallback for this component and object context. Existing personal configurations continue to take precedence.
  • Reset: Restores the built-in settings listed above, clears the displayed library and search state, and saves to the configuration currently loaded. If that configuration is the shared default, Reset updates it. Use Apply or Refresh afterward to reload the library.

Settings are scoped to the component type and Salesforce object, rather than individual records or page placements. Pages without an object use the general context. See Configuring a Custom Component for details.

Review permissions and test

Expand the Permissions card beneath the configuration buttons. Configure Microsoft permissions and consent for the authorization type and operations you intend to use. Browsing and downloading require read access; uploading requires write access. The reference includes additional OneDrive operations and does not mean every listed permission or operation is needed for this viewer.

Test browsing, search, downloads, and uploads under the intended user and connection. The upload control is not a separate configuration permission: Microsoft access determines whether the request succeeds. Use Creating an Entra ID App and Integration Connectors for connection setup.

Usage

1. Open the library and authorize

  1. Open the Salesforce page containing M365 OneDrive Library Viewer.
  2. If Authorization Required appears, click Authorize and complete Microsoft sign-in and consent in the popup. Allow popups for Salesforce if needed.
  3. Wait for the library to load. The Folder heading initially shows Root.

Delegated connections show the signed-in Microsoft user’s OneDrive. Application connections show the drive chosen by your administrator. Salesforce-managed credentials may require separate authentication through Salesforce’s credential setup.

2. Browse folders and files

  1. Review the file and folder names and their last-modified dates.
  2. Click a folder name to open it. The Folder heading changes to the folder you opened.
  3. Use Go up one folder to return to the previous level in your navigation.
  4. Use Previous and Next below the list to move between displayed pages. The middle number shows the current page and total loaded pages.

If folders are hidden by configuration, you can browse the visible files but cannot open subfolders through the list. Ask your administrator to enable Include Folders if you need folder navigation.

3. Open or download a file

Click a file name to open its Microsoft web link in a new browser tab. The Microsoft account in that tab must have access to the file. If no web link is available, the component displays a warning.

Click the Download icon beside a file to save a copy through your browser. Folder rows do not have a download control. Browser settings determine where downloaded files are saved.

4. Search the library

  1. Click Search library to show the Search OneDrive input.
  2. Enter your search text and click Submit search.
  3. Review the returned items under Search Results. Open files or folders from the results as needed.
  4. Click Clear search to leave search results and return to the folder you were browsing.

Search runs across the selected drive from its root, not just the currently open folder. Results use the configured query size, folder visibility, sorting, and display limit. Opening a folder result exits search mode and opens that folder. The up-folder control follows your navigation trail; it is not a full breadcrumb of the search result’s physical location.

Hiding the search input with Search library does not clear an active search. Use Clear search to return to folder browsing.

5. Upload a file

  1. Navigate to the destination folder. If you are viewing search results, clear the search first so the destination is clear.
  2. Click Upload file and select a file from your computer.
  3. Wait for the success notification and refreshed folder listing.

The file is uploaded to the current folder, or Root when no folder is open. It is stored in OneDrive, not as a Salesforce file. Uploading from search results still targets the current browsing folder rather than a selected search result. Use a distinct file name when you want a new file instead of updating an existing item at the same path.

The viewer selects one file at a time. If an upload fails because of permissions, file size, or service limits, review the error and ask your administrator for assistance or use OneDrive directly.

6. Refresh and troubleshoot

Refresh reloads saved configuration and authorization and returns to the library Root. It clears the active search, navigation trail, and paging position. It does not just refresh the folder currently displayed.

  • No items are shown: The folder may be empty, folders may be hidden, or the search may have no matches. Check your location and clear the search when appropriate.
  • The wrong drive appears: Confirm the Microsoft account used for delegated sign-in, or ask your administrator to review the configured application target.
  • A library cannot be resolved: Ask your administrator to verify the target user’s identifier, OneDrive availability, and connector permissions.
  • Sign-in is required again: Use Authorize when prompted. The Reauthorize OneDrive connector control starts a fresh delegated sign-in when needed.
  • An operation fails: Note the error and action for your administrator. Configuration administrators can use Show debug panel to inspect operation details; review diagnostic content before sharing.
Share this Doc

M365 OneDrive Library Viewer Component

Or copy link

CONTENTS

Free eBook: The Ultimate Guide to Power Platform Custom Connectors

Antimanual

Ask our AI support assistant your questions about our platform, features, and services.

You are offline
Chatbot avatar
What can I help you with?

Subscribe

×
Cancel