LauncherOptions.TreatAsUntrusted | treatAsUntrusted property

Applies to Windows and Windows Phone

Gets or sets a value that indicates whether the system should display a warning that the file or URI is potentially unsafe when starting the app associated with a file or URI.

Syntax


public:
property bool TreatAsUntrusted { 
   bool get();
   void set (bool value);
}

Property value

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

True if the warning should be displayed; otherwise false.

Examples

This sample uses LaunchUriAsync(Uri, LauncherOptions) | launchUriAsync(Uri, LauncherOptions) to launch a URI with a warning. The TreatAsUntrusted | treatAsUntrusted property indicates that the system should display a warning.


// The URI to launch
auto uri = ref new Windows::Foundation::Uri("http://www.bing.com");

void MainPage::DefaultLaunch()
{
   // Set the option to show a warning
   auto launchOptions = ref new Windows::System::LauncherOptions();
   launchOptions->TreatAsUntrusted = true;

   // Launch the URI with a warning prompt
   concurrency::task<bool> launchUriOperation(Windows::System::Launcher::LaunchUriAsync(uri, launchOptions));
   launchUriOperation.then([](bool success)
   {
      if (success)
      {
         // URI launched
      }
      else
      {
         // URI launch failed
      }
   });
}

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.System
Windows::System [C++]

Metadata

Windows.winmd

See also

LauncherOptions
Samples
Association launching sample
Tasks
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
Guidelines and checklist for file types and URIs
Reference
Launcher.LaunchFileAsync(IStorageFile, LauncherOptions)
Launcher.LaunchUriAsync(Uri, LauncherOptions)

 

 

Show:
© 2014 Microsoft