Jaa


DataPackageView.GetStorageItemsAsync Method

Definition

Gets the files and folders stored in a DataPackageView object.

public:
 virtual IAsyncOperation<IVectorView<IStorageItem ^> ^> ^ GetStorageItemsAsync() = GetStorageItemsAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<IVectorView<IStorageItem>> GetStorageItemsAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<IReadOnlyList<IStorageItem>> GetStorageItemsAsync();
function getStorageItemsAsync()
Public Function GetStorageItemsAsync () As IAsyncOperation(Of IReadOnlyList(Of IStorageItem))

Returns

An array of files and folders stored in a DataPackageView.

Attributes

Examples

The following example shows how to receive files and folders shared with your app as a collection of objects implementing IStorageItem.

if (shareOperation.Data.Contains(StandardDataFormats.StorageItems)) 
{
    shareOperation.ReportStarted();
    IReadOnlyList<IStorageItem> storageItems = null;
    storageItems = await shareOperation.Data.GetStorageItemsAsync();
    string fileList = String.Empty;

    for (int index = 0; index < storageItems.Count; index++) 
    {
        fileList += storageItems[index].Name;
            if (index < storageItems.Count - 1) {
                fileList += ", ";
            }
        }

    // To output the text from this example, you need a TextBlock control
    // with a name of "sharedContent".
    sharedContent.Text += "StorageItems: " + fileList + Environment.NewLine;

    shareOperation.ReportCompleted();
}

Applies to