> ## 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

> PlayFabId を持つユーザーのフレンド リストに Friend ユーザーを追加します。FriendPlayFabId、FriendUsername、FriendEmail、FriendTitleDisplayName のうち少なくとも 1 つを設定する必要があります。

PlayFabId を持つユーザーのフレンド リストに Friend ユーザーを追加します。FriendPlayFabId、FriendUsername、FriendEmail、FriendTitleDisplayName のうち少なくとも 1 つを初期化する必要があります。

## 構文

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

### パラメーター

**`titleEntityHandle`**   PFEntityHandle

PFAuthenticationGetEntityWithSecretKeyAsync を使用して取得したタイトル エンティティの PFEntityHandle。

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

値が設定されたリクエスト オブジェクト。

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

非同期操作用の XAsyncBlock。

### 戻り値

型: HRESULT

この API 操作の結果コード。

## 解説

この API は Win32、Linux、macOS で利用できます。ServerGetFriendsListAsync、ServerRemoveFriendAsync、ServerSetFriendTagsAsync も参照してください。操作の状態を取得するには XAsyncGetStatus を呼び出します。サービス呼び出しが失敗した場合、非同期処理の結果は E\_PF\_USERS\_ALREADY\_FRIENDS またはグローバル PlayFab サービス エラーのいずれかになります。エラー処理の詳細については、ドキュメント ページ「Handling PlayFab Errors」を参照してください。

## 要件

**ヘッダー:** PFFriends.h

## 関連項目

[PFFriends のメンバー](/services/playfab/api-references/c/pffriends/pffriends_members)


## Related topics

- [Services C API overview - PFFriends.h](/ja-jp/services/playfab/api-references/c/pffriends/pffriends_members.md)
- [PFFriendsServerGetFriendsListAsync](/ja-jp/services/playfab/api-references/c/pffriends/functions/pffriendsservergetfriendslistasync.md)
- [PFFriendsServerRemoveFriendAsync](/ja-jp/services/playfab/api-references/c/pffriends/functions/pffriendsserverremovefriendasync.md)
- [PFFriendsServerAddFriendRequest](/ja-jp/services/playfab/api-references/c/pffriendstypes/structs/pffriendsserveraddfriendrequest.md)
- [PFFriendsServerSetFriendTagsAsync](/ja-jp/services/playfab/api-references/c/pffriends/functions/pffriendsserversetfriendtagsasync.md)
