//user content previously from...
//var userContent = await portal.GetUserContentAsync(owner);
var packages = new List<PortalItemType>
{
PortalItemType.BasemapPackage,
PortalItemType.GeoprocessingPackage,
PortalItemType.LayerPackage,
PortalItemType.LocatorPackage,
PortalItemType.MapPackage,
PortalItemType.ProjectPackage,
PortalItemType.ScenePackage,
PortalItemType.RulePackage,
PortalItemType.VectorTilePackage
};
var folder = @"E:\Temp\PortalAPITest\";
foreach (var di in userContent.PortalItems.Where(pi => packages.Contains(pi.PortalItemType)))
{
var path = System.IO.Path.Combine(folder, di.Name);
await di.GetItemDataAsync(path);
}