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

# PFFriendsServerAddFriendAsync

> Adiciona o usuário Friend à lista de amigos do usuário com PlayFabId. Pelo menos um entre FriendPlayFabId, FriendUsername, FriendEmail ou FriendTitleDisplayName.

Adiciona o usuário Friend à lista de amigos do usuário com PlayFabId. Pelo menos um entre FriendPlayFabId, FriendUsername, FriendEmail ou FriendTitleDisplayName deve ser inicializado.

## Sintaxe

```cpp theme={null}
HRESULT PFFriendsServerAddFriendAsync(  
    PFEntityHandle titleEntityHandle,  
    const PFFriendsServerAddFriendRequest* request,  
    XAsyncBlock* async  
)  
```

### Parâmetros

**`titleEntityHandle`**   PFEntityHandle

PFEntityHandle para uma Entidade de título obtida usando PFAuthenticationGetEntityWithSecretKeyAsync.

**`request`**   [PFFriendsServerAddFriendRequest\*](/pt-BR/services/playfab/api-references/c/pffriendstypes/structs/pffriendsserveraddfriendrequest)

Objeto de solicitação preenchido.

**`async`**   XAsyncBlock\*<br />*Inout*

XAsyncBlock para a operação assíncrona.

### Valor de retorno

Tipo: HRESULT

Código de resultado desta operação de API.

## Comentários

Esta API está disponível no Win32, Linux e macOS. Consulte também ServerGetFriendsListAsync, ServerRemoveFriendAsync, ServerSetFriendTagsAsync. Chame XAsyncGetStatus para obter o status da operação. Se a chamada de serviço não for bem-sucedida, o resultado assíncrono será E\_PF\_USERS\_ALREADY\_FRIENDS ou qualquer um dos erros globais do Serviço PlayFab. Consulte a página de documentação "Handling PlayFab Errors" para obter mais detalhes sobre o tratamento de erros.

## Requisitos

**Cabeçalho:** PFFriends.h

## Confira também

[Membros de PFFriends](/pt-BR/services/playfab/api-references/c/pffriends/pffriends_members)


## Related topics

- [Visão geral da API C do Services - PFFriends.h](/pt-BR/services/playfab/api-references/c/pffriends/pffriends_members.md)
- [PFFriendsServerRemoveFriendAsync](/pt-BR/services/playfab/api-references/c/pffriends/functions/pffriendsserverremovefriendasync.md)
- [PFFriendsServerGetFriendsListAsync](/pt-BR/services/playfab/api-references/c/pffriends/functions/pffriendsservergetfriendslistasync.md)
- [PFFriendsServerAddFriendRequest](/pt-BR/services/playfab/api-references/c/pffriendstypes/structs/pffriendsserveraddfriendrequest.md)
- [PFFriendsServerSetFriendTagsAsync](/pt-BR/services/playfab/api-references/c/pffriends/functions/pffriendsserversetfriendtagsasync.md)
