Product.CheckPrivilegeAsync Method

Checks whether a user has a specified privilege.

Syntax

public:
static IAsyncOperation<PrivilegeCheckResult>^ CheckPrivilegeAsync(
         IUser^ user,
         uint32 privilegeId,
         bool attemptResolution,
         String^ friendlyDisplay
)  

Parameters

user
Type: IUser 

The user to check privileges for.

privilegeId
Type: uint32 

  The privilege to check. Supported privileges are listed in KnownPrivileges.

attemptResolution
Type: bool 

  Boolean indicating whether to allow the system to attempt to acquire the privilege for the user. When true, the system may prompt the user to upgrade to gold level.

friendlyDisplay
Type: String 

This value is not used anymore. See the remarks section below for detailed information on default strings.

Return value

Type: IAsyncOperation<PrivilegeCheckResult

An interface for tracking the progress of the asynchronous call. The result indicates the result of the privilege check.

Remarks

Important Before calling this method, verify that the user is signed in by checking the IUser.IsSignedIn Property. Calling this method for a user that is not signed in will throw exceptions. Note that the exeption will be thrown on task creation as opposed to task execution.
If the user is banned or parentally controlled, Xbox One will display a system message that notifies the user accordingly.

  • In the case of a user being banned, Xbox One uses the following base string:
    Because of your past behavior, you can't %1.  
    

    You may choose to provide a substring by passing in a value for friendlyDisplay, such as “play XboxTitle multiplayer”. This would display the following string on the user’s console:

    Because of your past behavior, you can't play XboxTitle multiplayer.  
    

If a user has an Xbox Live Silver account and a check against XPRIVILEGE_MULTIPLAYER_SESSIONS is performed, then the Xbox Live Gold upsell flow will be triggered.

Requirements

Namespace: Windows.Xbox.ApplicationModel.Store

Metadata: windows.winmd

See also

Reference

Product Class

Product Members

Windows.Xbox.ApplicationModel.Store Namespace