Customize OneDrive for Business site branding

Customize OneDrive for Business sites in Office 365 or by using the add-in model, depending on your organization's requirements. The customization process for OneDrive for Business sites is different than that for SharePoint on-premises sites.

Applies to: Office 365 | SharePoint 2013 | SharePoint Add-ins | SharePoint Online

Note

The name "apps for SharePoint" is changing to "SharePoint Add-ins". During the transition, the documentation and the UI of some SharePoint products and Visual Studio tools might still use the term "apps for SharePoint". For details, see New name for apps for Office and SharePoint.

OneDrive for Business sites are SharePoint sites, and you can customize them in the same way that you customize SharePoint. Before you customize your OneDrive for Business site, consider the short- and long-term implications of doing so, and apply the following guidelines:

  • Use Office 365 themes or the SharePoint theming engine to customize the branding for OneDrive for Business sites. If the theming engine is not sufficient, you can use CSS to apply your customizations.

  • Avoid using custom master pages to customize OneDrive for Business sites. This can add long-term costs because you'll have to apply your changes again when updates are applied to Office 365. You can use the theming engine and CSS to meet almost all of your custom branding needs.

  • Use embedded JavaScript to modify or hide site functionality.

  • Use the client object model (CSOM) to control language or regional settings in OneDrive for Business sites.

  • Do not use content types and site columns in OneDrive for Business sites. OneDrive for Business sites are for personal data and documents. Management policies and metadata are better applied to team and collaboration sites.

Contribute to this content

You can get the latest updates or contribute to this article on Github. You can also contribute to this and other samples on GitHub. We welcome your contributions.

Challenges with customizing OneDrive for Business sites

The architecture for OneDrive for Business sites is the same as that for personal or my sites in SharePoint 2010. Each OneDrive for Business site is its own site collection, which means that there isn't a centralized location where you can apply branding or other customizations.

In SharePoint on-premises, configuring OneDrive for Business sites, including my or personal sites, involves feature stapling at the farm level. You deploy your solution to your SharePoint farm and use the feature framework to activate the custom feature each time a my site is created. This approach does not work in Office 365 because it requires a farm solution.

OneDrive for Business site customization options

You can customize OneDrive for Business sites in Office 365 by using:

  • Office 365 suite-level settings (Office 365 themes and other settings).

  • A hidden add-in part with user context.

  • A configuration that you create and apply beforehand.

  • A remote timer job based on user profile updates.

Each option has advantages and disadvantages. Manual customization is another option, but that approach isn't realistic if you have a large number of sites.

Office 365 suite-level settings

Office 365 includes additional services that are not based on the SharePoint architecture. This means that enterprise branding and configuration in Office 365 goes beyond SharePoint sites to include the overall end user experience, and involves providing consistent configurations across the different services.

Branding is an example of an Office 365 enterprise requirement. You can use theming in Office 365 to control branding.

Figure 1 shows the settings that are available for Office 365 theming. These themes are applied across all Office 365 services.

Figure 1. Office 365 themes

Screenshot of the Office 365 theme settings.

By default, Office 365 theme settings control the OneDrive for Business site suite bar. You can use this option together with other options to provide the right branding elements cross your OneDrive for Business sites.

Note

When you use the Office 365 admin tool to change Office 365 theme settings, it can take some time for the settings to be applied to OneDrive for Business sites.

Hidden add-in part with user context

You can use a centralized landing page as the starting point for the customization process. With this approach, one location, such as a company intranet front page, opens when users start their browser. This is typical of midsize and large enterprises, where the corporate landing page is controlled by Active Directory group policy settings. End users can't override the default welcome page.

A hidden add-in part on the central landing page starts the customization process. The hidden add-in part can also be responsible for OneDrive for Business site creation, because users have to visit the OneDrive for Business site before the site creation process starts. The hidden add-in part hosts a page from a provider-hosted add-in in Microsoft Azure. This page starts the customization process.

The following is the process for using a hidden add-in part:

  1. The hidden add-in part is placed in a centralized site that end users access - typically, a corporate intranet front page.

  2. The add-in part hosts a page from a provider-hosted add-in. The server-side code initiates the customization process by adding metadata to the Azure storage queue. This means that this page receives the customization request, but does not apply any changes, to minimize the processing time.

  3. The Azure storage queue receives the messages to queue for processing. The customization process is handled asynchronously. This way, it doesn't matter how long the user stays on the intranet page. If the customization process was synchronous, the user would need to keep the browser open to the intranet page until the process finished, which is not an optimal experience.

  4. A WebJob is called when a new item is placed in the storage queue. This WebJob receives the parameters and metadata from the queued message to access the site collection. The WebJob uses an add-in-only token and has the permissions to manipulate site collections at the tenant level.

  5. Customizations are applied individually to users' sites when they visit the intranet front page to start the process.

This process is a reliable way to ensure that OneDrive for Business sites are customized. You can add customization versioning logic to the process to apply updates to the OneDrive for Business sites. This option requires that you have a centralized landing page for your users.

Configuration created and applied beforehand

You can create OneDrive for Business sites before users access them by using a new API that creates OneDrive for Business sites for specific users in a batch process via CSOM or REST. You can use a Windows PowerShell script to initiate the code or write code that calls the remote APIs.

Figure 2. Precreated configuration

Image that shows an administrator precreating a SharePoint site

This involves the following process:

  1. An administrator uses the remote creation APIs to create OneDrive for Business sites for users and applies customizations to the sites as part of the script process.

  2. OneDrive for Business sites are created for specific users and associated with their user profiles

This process requires that you manage new users and updates manually, which is more work than using the hidden add-in part approach. This option is useful if you are migrating from another file sharing solution to OneDrive for Business and you don't want your users to have to access the site to start the site creation process.

Remote timer job based on user profile updates

You can scan user profiles to identify users for whom OneDrive for Business sites have been created and then apply the changes to the sites as needed. This involves a scheduled job that runs outside of SharePoint that periodically checks status and applies customizations. The scheduled job can run as a WebJob in Azure or as a Windows PowerShell script.

Figure 3. Scheduled remote timer job

Image that shows the scheduled remote timer job process

This involves the following process:

  1. The scheduled task accesses user profiles for users who have OneDrive for Business sites provisioned is initiated.

  2. Sites are customized one-by-one based on the business requirements.

Before you choose the scheduling option, consider the scale of your deployment. One drawback to this option is that users can access OneDrive for Business sites before the customizations are applied. You can also use this option to ensure that users haven't changed any required settings or to ensure that the OneDrive for Business site content aligns with company policies.

Additional resources