Utility.ImportAppLicense method

SharePoint Online

Imports the specified test license into the specified SharePoint deployment for app testing purposes.

Namespace:  Microsoft.SharePoint.Client.Utilities
Assembly:  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

public static void ImportAppLicense(
	ClientRuntimeContext context,
	string licenseTokenToImport,
	string contentMarket,
	string billingMarket,
	string appName,
	string iconUrl,
	string providerName,
	int appSubtype


Type: Microsoft.SharePoint.Client.ClientRuntimeContext
Type: System.String

An XML fragment that represents the app license token to import.

Type: System.String

The content market in which you want to sell the app.

Type: System.String

The billing market for the app.

Type: System.String

The name of the app.

Type: System.String

URL of the app icon, as it appears on Office Store. Can be left blank.

Type: System.String

Name of the provider of the app.

Type: System.Int32

The subtype of the app.

Use this parameter to specify whether this license is for an app for SharePoint used exclusively to package an app for Office, and if so, the type of app for Office. This enables corporate catalogs to filter and display apps for Office packaged in apps for SharePoint.

Valid values are limited to:




An app for SharePoint used to package a single task pane app for Office.


An app for SharePoint used to package a single content app for Office.


An app for SharePoint used to package a single dictionary task pane app for Office.


An app for SharePoint that is not being used exclusively to package an app for Office. This includes:

  • An app for SharePoint that does not contain any apps for Office functionality.

  • An app for SharePoint that, in addition to its SharePoint-specific functionality, installs documents and/or templates that contain one or more apps for Office.

  • An app for SharePoint that packages multiple apps for Office.

In order to call this method, the caller must be one of the following:

  • An administrator of the site collection being called.

  • An administrator of the tenancy into which the license is imported, if the SharePoint deployment into which the license is imported is a tenancy.

  • A farm administrator

To assist in testing the app license checking code in your app, SharePoint enables you to upload up to ten test licenses per SharePoint deployment. These test licenses are XML fragments that conform to the app license schema.

For test licenses, you need not specify the deployment ID in the app license XML. The ImportAppLicense method supplies the correct deployment ID to the license token XML.

For more information about the app license XML definition, see Office and SharePoint Add-in license XML schema structure. For more information about app licenses, see License your Office and SharePoint Add-ins.