> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PairControllerWithUser

> IXtfUserClient::PairControllerWithUser Method

Pairs the user identified by the specified email address to the controller with the specified controller ID.

## Syntax

```cpp theme={null}
public:
HRESULT PairControllerWithUser(
         LPCWSTR userName,
         UINT64 controllerId
)  
```

### Parameters

*userName*\
Type: LPCWSTR

The email address of the user to pair with the controller.

*controllerId*\
Type: UINT64

The controller ID of the controller.

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

To get the email address of the user, call [ListUsers](https://docs.xbox.com/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/listusers-ixtfuserclient-xtfuser-xbox-windows-m.md). In the returned [XTF\_USER\_DATA](https://docs.xbox.com/reference/tools/xtf/xtfuser/structures/XTF_USER_DATA-xtfuser-xbox-windows-t.md) structure, examine the *pszEmailAddress* member.

Pairing a controller by using **PairControllerWithUser** is additive. If a user is already paired with the controller, the user specified by *userName* is also paired with the controller. To create an exclusive pairing, call **PairControllerWithUserIdExclusive** or **PairControllerWithUserExclusive**.

## Requirements

**Header:** xtfuser.h

**Library:** xtfuser.lib

**Supported platforms:** Windows (for XBOX console tools)

## See also

[PairControllerWithUserId](https://docs.xbox.com/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/paircontrollerwithuserid-ixtfuserclient-xtfuser-xbox-windows-m.md)


## Related topics

- [PairControllerWithUserId](https://docs.xbox.com/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/paircontrollerwithuserid-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient Interface (Interface contents)](https://docs.xbox.com/reference/tools/xtf/xtfuser/classes/IXtfUserClient/ixtfuserclient-xtfuser-xbox-windows-t.md)
- [XR-115 Addition and Removal of Users or Controllers During Gameplay](https://docs.xbox.com/publishing/certification/xr/xr-115.md)
- [XtfCreateUserClient](https://docs.xbox.com/reference/tools/xtf/xtfuser/methods/xtfcreateuserclient-xtfuser-xbox-windows-m.md)
- [XBOX Requirements for XBOX Games](https://docs.xbox.com/publishing/certification/xbox-requirements.md)
