public static async Task <DataPayload> GetData(this DataPackageView data) { var shareData = new DataPayload { Title = data.Properties.Title, Description = data.Properties.Description }; var formats = data.AvailableFormats.ToList(); shareData.AppLink = await data.GetAppLink(); formats.Remove(StandardDataFormats.ApplicationLink); shareData.Bitmap = await data.GetBitmap(); formats.Remove(StandardDataFormats.Bitmap); shareData.Html = await data.GetHtml(); formats.Remove(StandardDataFormats.Html); shareData.Rtf = await data.GetRtf(); formats.Remove(StandardDataFormats.Rtf); shareData.Text = await data.GetText(); formats.Remove(StandardDataFormats.Text); shareData.WebLink = await data.GetWebLink(); formats.Remove(StandardDataFormats.WebLink); shareData.StorageItems = await data.GetStorageItems(); formats.Remove(StandardDataFormats.StorageItems); // Since we removed all the built-in data formats, the remaining will be the custom data formats that the developer has included var customData = new Dictionary <string, object>(); foreach (var customFormat in formats) { var d = await data.GetDataAsync(customFormat); customData.Add(customFormat, d); } shareData.CustomData = new ReadOnlyDictionary <string, object>(customData); return(shareData); }