Windows Dev Center

LauncherOptions.ContentType | contentType property

Gets or sets the content type that is associated with a URI that represents a file on the network.


var contentType = launcherOptions.contentType;
launcherOptions.contentType = contentType;

Property value

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The content type of the URI.


ContentType may only be specified when launching a URI using Launcher.LaunchUriAsync(Uri, LauncherOptions).

The ContentType property allows your app to specify a URI along with a content type. You can use this to associate a URI pointing to a resource on the network with a file type, instead of a URI scheme name. Windows will attempt to use the file type computed from the content type to select the app to launch. The default file handler is then passed the URI instead of a file path. So for example if you have an http:// URI pointing to a .docx file, clicking on it would normally open the browser and begin a file download. By using the ContentType property you can skip the intermediate step and have the default file handler launch immediately. The file handler can then directly access the file on the network using the path embedded in the URI.

If the handler is unable to work directly on the URI, a copy of the file will be downloaded on their behalf.

Because ContentType allows you to directly launch a file handler the same security checks that apply to file launching apply to URI launches with this option specified. See How to launch the default app for a file (C#/VB/C++) and How to launch the default app for a file (JavaScript) for more details on those security checks.

Note  This functionality only works if the default file handler supports being passed a URI to a file on the network. The default file handler must also be able to authenticate with the file’s server. Because of these limitations you should only use the ContentType property if you have thoroughly tested the end to end scenario between your app and the app’s that you expect to handle the files being launched


Call the Launcher.LaunchUriAsync(Uri, LauncherOptions) method with ContentType set to the content type associated with the URI being launched.

// The URI to launch
var uriToLaunch = "";

// Create a Uri object from a URI string 
var uri = new Windows.Foundation.Uri(uriToLaunch);

// Set the URI’s content type
var options = new Windows.System.LauncherOptions();
options.contentType = "application/";

Windows.System.Launcher.launchUriAsync(uri, options).then(
   function (success) {
      if (success) {
         // URI launched
      } else {
         // URI launch failed

Requirements (device family)

Device family


API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::System [C++]



Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8


Windows::System [C++]



See also

Association launching sample
How to launch the default app for a file (JavaScript)
How to launch the default app for a file (C#/VB/C++)
How to launch the default app for a URI (JavaScript)
How to launch the default app for a URI (C#/VB/C++)
Guidelines and checklist for file types and URIs
Launcher.LaunchFileAsync(IStorageFile, LauncherOptions)
Launcher.LaunchUriAsync(Uri, LauncherOptions)



© 2015 Microsoft