ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core.Portal Namespace / PortalItem Class / GetItemDataAsync Method
Example

In This Topic
    GetItemDataAsync Method
    In This Topic
    Gets the item data. This resource is available only for the file and text item types.
    Syntax
    Public Function GetItemDataAsync( _
       ByVal fileName As String _
    ) As Task(Of Boolean)
    public Task<bool> GetItemDataAsync( 
       string fileName
    )

    Parameters

    fileName
    Remarks
    The data component of an item (the "item file") is used to stream the actual data represented by the item to the client.
    Example
    Portal: Download any package items in the user content
    {
      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\";
      //Get the UserContent - refer to the initialization section above for more details
      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);
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also