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

# Getting Title Storage blob metadata

> Flat C code example for retrieving XBOX Title Storage blob metadata with XblTitleStorageGetBlobMetadataAsync, including paging through result handles.

This topic demonstrates how to retrieve blob metadata from XBOX Title Storage by using the following flat C code examples.

#### Flat C

```cpp theme={null}
auto asyncBlock = std::make_unique<XAsyncBlock>();
asyncBlock->queue = queue;
asyncBlock->context = nullptr;
asyncBlock->callback = [](XAsyncBlock* asyncBlock)
{
    std::unique_ptr<XAsyncBlock> asyncBlockPtr{ asyncBlock };
    XblTitleStorageBlobMetadataResultHandle handle;
    HRESULT hr = XblTitleStorageGetBlobMetadataResult(asyncBlock, &handle);

    if (SUCCEEDED(hr))
    {
        if (blobMetadataResultHandle != nullptr)
        {
            XblTitleStorageBlobMetadataResultCloseHandle(blobMetadataResultHandle);
        }

        blobMetadataResultHandle = handle;
    }

};

HRESULT hr = XblTitleStorageGetBlobMetadataAsync(
    xboxLiveContext,
    scid,
    storageType,
    blobPath.c_str(),
    xboxUserId,
    skipItems,
    maxItems,
    asyncBlock.get()
);

if (SUCCEEDED(hr))
{
    asyncBlock.release();
}
```

## Only one page  of  XblTitleStorageBlobMetadata objects exists

The following code example demonstrates how to use `XblTitleStorageBlobMetadataResultHandle` to retrieve the first page of the list of [XblTitleStorageBlobMetadata](/reference/live/xsapi-c/title_storage_c/structs/xbltitlestorageblobmetadata) objects.
<Note>Depending on the number of blobs that the title has in Title Storage, there might be several pages of `XblTitleStorageBlobMetadata`.</Note>

#### Flat C

```cpp theme={null}
XblTitleStorageBlobMetadataResultHandle handle = blobMetadataResultHandle;

const XblTitleStorageBlobMetadata* items;
size_t itemsSize;

HRESULT hr = XblTitleStorageBlobMetadataResultGetItems(handle, &items, &itemsSize);
```

## Determine if more pages of XblTitleStorageBlobMetadata objects exist

The following code example demonstrates how to check to see if there are more pages of `XblTitleStorageBlobMetadata` to retrieve from Title Storage.

#### Flat C

```cpp theme={null}
XblTitleStorageBlobMetadataResultHandle handle = blobMetadataResultHandle;

bool hasNext;

HRESULT hr = XblTitleStorageBlobMetadataResultHasNext(handle, &hasNext);
```

## Retrieving more pages of XblTitleStorageBlobMetadata objects

The following code example demonstrates how to retrieve the next page of `XblTitleStorageBlobMetadata` objects.

#### Flat C

```cpp theme={null}
XblTitleStorageBlobMetadataResultHandle handle = blobMetadataResultHandle;

auto asyncBlock = std::make_unique<XAsyncBlock>();
asyncBlock->queue = queue;
asyncBlock->context = nullptr;
asyncBlock->callback = [](XAsyncBlock* asyncBlock)
{
    std::unique_ptr<XAsyncBlock> asyncBlockPtr{ asyncBlock };
    XblTitleStorageBlobMetadataResultHandle handle{ nullptr };
    
    HRESULT hr = XblTitleStorageBlobMetadataResultGetNextResult(asyncBlock, &handle);
};

HRESULT hr = XblTitleStorageBlobMetadataResultGetNextAsync(handle, maxItems, asyncBlock.get());

if (SUCCEEDED(hr))
{
    asyncBlock.release();
}
```

## Duplicating XblTitleStorageBlobMetadataResultHandle

The following code example demonstrates how to create a duplicate of `XblTitleStorageBlobMetadataResultHandle`.

#### Flat C

```cpp theme={null}
XblTitleStorageBlobMetadataResultHandle handle = blobMetadataResultHandle;
XblTitleStorageBlobMetadataResultHandle duplicatedHandle;

HRESULT hr = XblTitleStorageBlobMetadataResultDuplicateHandle(handle, &duplicatedHandle);
```

## Closing XblTitleStorageBlobMetadataResultHandle

The following code example demonstrates how to close `XblTitleStorageBlobMetadataResultHandle`.

<Note>You must close this handle when you're done using it.</Note>

#### Flat C

```cpp theme={null}
XblTitleStorageBlobMetadataResultHandle handle = blobMetadataResultHandle;
XblTitleStorageBlobMetadataResultCloseHandle(handle);
blobMetadataResultHandle = nullptr;
```

## See also

[XAsyncBlock](/reference/system/xasync/structs/xasyncblock)

[XblTitleStorageBlobMetadataResultCloseHandle](/reference/live/xsapi-c/title_storage_c/functions/xbltitlestorageblobmetadataresultclosehandle)

[XblTitleStorageGetBlobMetadataAsync](/reference/live/xsapi-c/title_storage_c/functions/xbltitlestoragegetblobmetadataasync)

[XblTitleStorageGetBlobMetadataResult](/reference/live/xsapi-c/title_storage_c/functions/xbltitlestoragegetblobmetadataresult)

[XblTitleStorageBlobMetadata](/reference/live/xsapi-c/title_storage_c/structs/xbltitlestorageblobmetadata)

[XblTitleStorageBlobMetadataResultGetItems](/reference/live/xsapi-c/title_storage_c/functions/xbltitlestorageblobmetadataresultgetitems)

[XblTitleStorageBlobMetadataResultHasNext](/reference/live/xsapi-c/title_storage_c/functions/xbltitlestorageblobmetadataresulthasnext)

[XblTitleStorageBlobMetadataResultGetNextAsync](/reference/live/xsapi-c/title_storage_c/functions/xbltitlestorageblobmetadataresultgetnextasync)

[XblTitleStorageBlobMetadataResultGetNextResult](/reference/live/xsapi-c/title_storage_c/functions/xbltitlestorageblobmetadataresultgetnextresult)

[XblTitleStorageBlobMetadataResultDuplicateHandle](/reference/live/xsapi-c/title_storage_c/functions/xbltitlestorageblobmetadataresultduplicatehandle)
