Skip to main content

Microsoft Drives

The microsoft-drives module lets editors search and import files from OneDrive or SharePoint through Brightspot's federated search, and can convert imported documents and spreadsheets into other Brightspot content.

Dependencies

Depends on db-http, the Microsoft Graph Java SDK, and the platform's shared com.psddev:microsoft-core module for Microsoft app registration and per-user sign-in (MSAL4J-based OAuth2).

Installation

<!-- Requires Brightspot 5.0 or later. -->
<dependency>
<groupId>com.brightspot.dbhttp</groupId>
<artifactId>microsoft-drives</artifactId>
<version>1.0.0</version>
</dependency>

API reference

brightspot.microsoft.drives.MicrosoftDrivesDatabase

Extends HttpDatabase. Searches Microsoft Graph's /search/query endpoint, filterable by file type and creator, and fetches file details in batched Graph API requests. Search and detail results are cached for five minutes.

brightspot.microsoft.drives.MicrosoftDrivesFile

Extends ExternalItem.

FieldTypeDescription
fileIdStringThe Microsoft Graph item Id.
nameStringThe file name.
cdnUrlStringA CDN-served URL for the file.
webUrlStringA link to view the file in OneDrive or SharePoint.
createdAtDateDateWhen the file was created.
lastUpdateDateDateWhen the file was last modified. Filterable in search.
mimeTypeStringThe file's MIME type.
contentSizeLongThe file size in bytes.

Configuration

Microsoft Drives has no service-specific settings of its own — authentication is handled entirely through the shared Microsoft app registration (MicrosoftApp, configured on the CMS Tool) and each editor's personal Microsoft sign-in. The module requests the User.Read, Files.Read.All, and Sites.Read.All scopes during sign-in.

Extending the plugin

To let editors create a local content record from search results, define a content type and extend UpdatableExternalItemConverter<MicrosoftDrivesFile, T>, implementing both convert (initial import) and update (re-import). Have the content type implement MicrosoftDrivesImport so it can report the file extension it accepts and populate its file and title fields from the imported MicrosoftDrivesFile.

Implementing update also enables sync: MicrosoftDrivesSyncable compares the source file's modified time against the time it was last imported, and an editor can re-import a synced record—producing a draft with the differences if it's published, or updating it directly otherwise.

For Word documents specifically, extend DocumentConverter<T> instead of implementing the interfaces directly—it's an @Embedded converter, configured inline in the CMS, with createType, convert, and update methods that parallel the pattern above. A similar MicrosoftDrivesSpreadsheetConverter base exists for spreadsheets.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.