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

Retrieves info for the containers in an **XGameSaveProvider**.

## Syntax

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

### Parameters

*provider*   \_In\_\
Type: XGameSaveProviderHandle

An **XGameSaveProvider** handle with the desired container.

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

Name of container to retrieve info about, will return only one result if found. If more than one container is desired use [XGameSaveEnumerateContainerInfo](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfo) or [XGameSaveEnumerateContainerInfoByName](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfobyname).

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

Pointer to the calling object for context.

*callback*   \_In\_\
Type: XGameSaveContainerInfoCallback\*

Callback function to determine the results of and collect data from the [XGameSaveContainerInfo](/reference/system/xgamesave/structs/xgamesavecontainerinfo) call.

### Return value

Type: HRESULT

Function result

#### 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>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

A container is a collection of metadata and a reference point for the set of blobs within it. If the container name is known ahead of time it is possible to use this API to return the information for just that container. This is useful for bringing back specific information about a player instead of calling for all of it each time you need information. You can find the make up of an **XGameSaveContainer** in the [XGameSaveContainerInfo](/reference/system/xgamesave/structs/xgamesavecontainerinfo) struct.

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

**Header:** XGameSave.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

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