ContentType | contentType property

LauncherOptions.ContentType | contentType property

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


public string ContentType { get; set; }

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 Launch the default app for a file 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
Important  This property is only implemented on Desktop devices.


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

// The URI to launch
string uriToLaunch = @"";
var uri = new Uri(uriToLaunch);

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

   // Launch the URI with the content type
   var success = await Windows.System.Launcher.LaunchUriAsync(uri, options);

   if (success)
      // URI launched
      // URI launch failed

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::System [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

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)
Launch the default app for a file
How to launch the default app for a URI (JavaScript)
Launch the default app for a URI
Guidelines for file types and URIs
Launcher.LaunchFileAsync(IStorageFile, LauncherOptions)
Launcher.LaunchUriAsync(Uri, LauncherOptions)



© 2016 Microsoft