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

# XGameSaveGetContainerInfo

> XGameSaveGetContainerInfo

# XGameSaveGetContainerInfo

**XGameSaveProvider** 内のコンテナーの情報を取得します。

## Syntax

```cpp theme={null}
HRESULT XGameSaveGetContainerInfo(  
         XGameSaveProviderHandle provider,  
         const char* containerName,  
         void* context,  
         XGameSaveContainerInfoCallback* callback  
)  
```

### Parameters

*provider*   \_In\_\
型: XGameSaveProviderHandle

目的のコンテナーを含む **XGameSaveProvider** ハンドル。

*containerName*   \_In\_z\_\
型: char\*

情報を取得するコンテナーの名前。見つかった場合は 1 つの結果のみを返します。複数のコンテナーが必要な場合は [XGameSaveEnumerateContainerInfo](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfo) または [XGameSaveEnumerateContainerInfoByName](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfobyname) を使用してください。

*context*   \_In\_opt\_\
型: void\*

コンテキストの呼び出し元オブジェクトへのポインター。

*callback*   \_In\_\
型: XGameSaveContainerInfoCallback\*

[XGameSaveContainerInfo](/reference/system/xgamesave/structs/xgamesavecontainerinfo) 呼び出しの結果を判別し、そこからデータを収集するコールバック関数。

### Return value

型: HRESULT

関数の結果

#### Common errors

* E\_GS\_INVALID\_CONTAINER\_NAME
* E\_GS\_USER\_CANCELED
* E\_GS\_CONTAINER\_NOT\_IN\_SYNC
* E\_GS\_CONTAINER\_SYNC\_FAILED
* E\_GS\_HANDLE\_EXPIRED

## Remarks

<Note>この関数は、時間依存スレッドから呼び出しても安全ではありません。詳細については、[Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads) を参照してください。</Note>

コンテナーは、メタデータのコレクションと、その中の BLOB のセットの参照ポイントです。コンテナー名が事前にわかっている場合は、この API を使用してそのコンテナーだけの情報を返すことが可能です。これは、情報が必要になるたびにすべての情報を要求するのではなく、プレイヤーに関する特定の情報を取り戻すのに役立ちます。**XGameSaveContainer** の構成については、[XGameSaveContainerInfo](/reference/system/xgamesave/structs/xgamesavecontainerinfo) 構造体を参照してください。

```cpp theme={null}
void Sample::_GetContainerInfo(const char* name) 
{ 
    XGameSaveContainerInfoCallback* callback = [](_In_ const XGameSaveContainerInfo* info, _In_ void* ctx) -> bool 
    { 
        auto self = reinterpret_cast<Sample*>(ctx); 
        self->_UpdateContainerList(info); 
        return true; 
    }; 
  
    HRESULT hr = XGameSaveGetContainerInfo(_provider, name, this, callback); 
    if (FAILED(hr)) 
    { 
        _HandleContainerErrors(name, hr); 
    } 
} 
 
void Sample::_UpdateContainerList(const XGameSaveContainerInfo* container) 
{ 
    //update UX 
    printf("%s - %s: %I64dbytes %d blobs\n", container->name, container->displayName, container->totalSize, container->blobCount); 
    if (strcmp(container->name, "AutoSave") == 0) 
    { 
        _ReadContainerBlobsAsync(container); 
    } 
} 
 
void Sample::_HandleContainerErrors(const char* name, HRESULT hr) 
{ 
    switch (hr) 
    { 
    case E_GS_INVALID_CONTAINER_NAME: 
        printf("\'%s\' name is invalid for a container", name); 
        break; 
    case E_GS_USER_CANCELED: 
        printf("Container %s failed to sync user canceled hr=0x%08x\n", name, hr); 
        break; 
    case E_GS_CONTAINER_NOT_IN_SYNC: 
    case E_GS_CONTAINER_SYNC_FAILED: 
        printf("Container %s failed to sync hr=0x%08x\n", name, hr); 
        break; 
    case E_GS_HANDLE_EXPIRED: 
        printf("Container %s failed, re-initialize provider", name); 
        break; 
    case S_OK: 
        break; 
    default: 
        printf("Unknown Container error %s hr=0x%08X\n", name, hr); 
    } 
}
```

## Requirements

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

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体および XBOX Series 本体

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XGameSave](/reference/system/xgamesave/xgamesave_members)\
[XGameSaveCreateContainer](/reference/system/xgamesave/functions/xgamesavecreatecontainer)\
[XGameSaveContainerInfo](/reference/system/xgamesave/structs/xgamesavecontainerinfo)\
[Debugging Game Saves](/build/core-features/common/game-save/game-saves-debugging)


## Related topics

- [XGameSaveContainerInfoCallback](/ja-jp/reference/system/xgamesave/functions/xgamesavecontainerinfocallback.md)
- [XGameSave](/ja-jp/reference/system/xgamesave/xgamesave_members.md)
- [GDK 向け Unity C# API ラッパー](/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XGameSaveContainerInfo](/ja-jp/reference/system/xgamesave/structs/xgamesavecontainerinfo.md)
- [XGameSaveEnumerateContainerInfo](/ja-jp/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfo.md)
