ArcGISPortalFindItemsAsync Method (PortalQueryParameters, CancellationToken)
public Task<PortalQueryResultSet<PortalItem>> FindItemsAsync( PortalQueryParameters queryParams, CancellationToken cancellationToken )
Portal.PortalItem objects are user items, usually related to a specific area of interest such as maps, applications, and tools. This version of the Portal.ArcGISPortal.SearchItemsAsync Method allows searching for specific items within ArcGIS Online (AGOL) or ArcGIS Portal by providing PortalQueryParameters to limit the scope of which items are returned.
You can call this version of the Method before calling the one of the ArcGISPortal.CreateAsync Methods and obtain PortalItem information but the Portal property will not be populated with valid information (i.e. its value will be Nothing/null). It is a recommended best practice to call one of the ArcGISPortal.CreateAsync Methods before calling this method so that all of the properties in the PortalItem will contain valid data.
You do not have to be a logged in user to get information from this version of the Portal.ArcGISPortal.SearchItemsAsync Method. You can gain this information from anonymous access. However, to obtain information about items that have a PortalAccess level of Private you need to use the AuthenticationManager by supplying the appropriate username/password credentials.
By default the Query property that is used in this version of the Portal.ArcGISPortal.SearchItemsAsync Method uses a default set of high performance index fields when providing simple keyword string(s) for the search. As of AGOL/ArcGIS Portal v2.1, these fields are: title, tags, snippet, description, accessinformation, spatialreference, type and typekeywords. For more advanced searches, developers can preface their simple keyword strings with a more exhaustive set of REST named fields followed by a colon (:). These advanced searches can also take advantage of Boolean operators (AND, NOT, OR, +), wildcard operators (* and ?), as well as other techniques to more fully utilize the AGOL/ArcGIS Portal search capabilities. Comprehensive details on using the advanced search strings that follow the REST specification can be found in the Search Reference document in the ArcGIS Portal API.
The following are a few advanced REST search scenarios with example strings that you might consider using for the Portal.SearchParameters.QueryString Property:
To find one specific PortalItem by it's Id: "id:00e5e70929e14055ab686df16c842ec1"
To find all WebMap PortalItems with the word 'florida' in the Title field: "title:florida AND type:web map"
To find all Layer Package PortalItems with the word 'florida' in the Title field: "title:florida AND type:layer package"
To find all PortalItems with the word 'florida' in the Title field and the word 'esri' in the LicenseInfo field: "title:florida AND licenseinfo:esri"
To find all PortalItems with the word 'florida' in the Title field and not have the word 'esri' in the LicenseInfo field: "title:florida NOT licenseinfo:esri"
To find all PortalItems with located within a specific spatial extent and the word 'esri' in the LicenseInfo: "extent:[-114.3458, 21.7518] - [-73.125, 44.0658] AND licenseinfo:esri"
To find all PortalItems with a SpatialReference.WKID of 4267: "spatialreference:4267"
To find all PortalItems with a SpatialReference.WKID of 4267 or have the word 'cancer' in the Title field: "spatialreference:4267 OR title:cancer"
NOTE: It is not required to use the advanced REST search syntax to find PortalItems with this version of the Method. Simple string syntax for the Portal.SearchParameters.QueryString Property such as: "florida" will find all occurrences of that string in the default high performance index fields.