ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core.Portal Namespace / PortalQueryParameters Class / Limit Property
Example

In This Topic
    Limit Property
    In This Topic
    Gets or sets the maximum number of results to be included in the result set response. The default value is 10 and the maximum allowed value is 100. The start index, along with the limit parameter can be used to paginate the search results. The actual number of returned results may be less than Limit. This happens when the number of results remaining after StartIndex is less than Limit.
    Syntax
    Public Property Limit As Integer
    public int Limit {get; set;}
    Remarks
    Corresponds to the "num=" parameter of a portal REST query. When not specified, num is assumed to be 10
    Example
    Portal: Execute a portal search
    {
      var owner = portal.GetSignOnUsername();
      var portalInfo = await portal.GetPortalInfoAsync();
    
      //1. Get all web maps
      var query1 = PortalQueryParameters.CreateForItemsOfType(PortalItemType.WebMap);
    
      //2. Get all web maps and map services - include user, organization
      // and "usa" in the title
      var query2 = PortalQueryParameters.CreateForItemsOfTypes(new List<PortalItemType>() {
      PortalItemType.WebMap, PortalItemType.MapService}, owner, "", "title:usa");
      query2.OrganizationId = portalInfo.OrganizationId;
    
      //retrieve in batches of up to a 100 each time
      query2.Limit = 100;
    
      //Loop until done
      var portalItems = new List<PortalItem>();
      while (query2 != null)
      {
        //run the search
        PortalQueryResultSet<PortalItem> results = await portal.SearchForContentAsync(query2);
        portalItems.AddRange(results.Results);
        query2 = results.NextQueryParameters;
      }
      //process results
      foreach (var pi in portalItems)
      {
        //Do something with the portal items
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also