DataPackageView.GetStorageItemsAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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();
}