Skip to main content

XUserAddOptions

Specifies the options for adding a user.

Syntax

Constants

Remarks

There are some edge cases that developers should know about if they repeatedly call XUserAddAsync with options set to XUserAddOptions::AddDefaultUserSilently:
  • If you call this repeatedly, and we know the default user who launched the game, it will return that same user.
  • If the previously known default user has signed out, and there is only one user signed into the device, it will mark that user as the new “default” user and return that.
  • If the previously known default user has signed out, and there are multiple users signed into the device, it will return E_GAMEUSER_NO_DEFAULT_USER.
  • In developer launches, the user that will be the default user is the auto sign in user, which can be specified by setting that user as the auto sign in user in DevHome or by using xbconfig (NDA topic) DefaultUser.
If a default user is not available*, XUserAddResult returns E_GAMEUSER_NO_DEFAULT_USER. You must call XUserAddAsync with options not set to XUserAddOptions::AddDefaultUserSilently. There are also some edge cases that developers should know about if they repeatedly call XUserAddAsync with options set to XUserAddOptions::AddDefaultUserAllowingUI. These are very similar (but not identical) to the silent UI case:
  • If you call this repeatedly, and we know the default user who launched the game, it will return that same user.
  • If the previously known default user has signed out, and there is only one user signed into the device, it will mark that user as the new “default” user and return that.
  • If the user has signed out who initially launched the game, and the number of users is either 0 or more than 1, the system will show UI to get the user and then set that user as the default.
In XUserAddAsync, you cannot use XUserAddOptions::AllowGuests with XUserAddOptions::AddDefaultUserSilently. A guest cannot be the default user. You can use XUserAddOptions::AllowGuests, even if the current platform does not support guests. The following example demonstrates how to asynchronously add a user to a game session.

Requirements

Header: XUser.h Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

See also

XUser XUserAddAsync XUserAddResult
Last modified on August 20, 2026