Method FindItemsAsync
FindItemsAsync(PortalQueryParameters)
Finds portal items that match the query parameters specified.
Declaration
public Task<PortalQueryResultSet<PortalItem>> FindItemsAsync(PortalQueryParameters queryParams)
Parameters
Type | Name | Description |
---|---|---|
PortalQueryParameters | queryParams | The search parameters. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PortalQueryResultSet<PortalItem>> | The task object representing the asynchronous search items operation. The value of the task result is a PortalQueryResultSet<T> object. |
Remarks
This method obtains a PortalQueryResultSet<T> object that contains PortalItem objects. Use the Results property to get the collection of PortalItem objects.
Portal.PortalItem objects are user items, usually related to a specific area of interest such as maps, applications, and tools. This 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 do not have to be a logged in user to get information from this 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 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 Query 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 method. Simple string syntax for the Query property such as: "florida" will find all occurrences of that string in the default high performance index fields.
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Standard 2.0 | 100.3 - 100.15 |
.NET 6.0 | 100.13 - 100.15 |
.NET 6.0 Windows | 100.13 - 100.15 |
.NET Framework | 100.0 - 100.15 |
.NET 5 | 100.10 - 100.12 |
.NET Core 3.1 | 100.7 - 100.12 |
Xamarin.Android | 100.0 - 100.15 |
Xamarin.iOS | 100.0 - 100.15 |
UWP | 100.0 - 100.15 |
FindItemsAsync(PortalQueryParameters, CancellationToken)
Finds portal items that match the query parameters specified
Declaration
public async Task<PortalQueryResultSet<PortalItem>> FindItemsAsync(PortalQueryParameters queryParams, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
PortalQueryParameters | queryParams | The search parameters. |
CancellationToken | cancellationToken | A CancellationToken with which to cancel the operation if required. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PortalQueryResultSet<PortalItem>> | The task object representing the asynchronous search items operation. The value of the task result contains a PortalQueryResultSet<T> object that contains PortalItem objects. Use the Results Property to get collection. |
Remarks
This version of the Method obtains a PortalQueryResultSet<T> object that contains PortalItem objects. Use the Results property to get the collection of PortalItem objects.
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.
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Standard 2.0 | 100.3 - 100.15 |
.NET 6.0 | 100.13 - 100.15 |
.NET 6.0 Windows | 100.13 - 100.15 |
.NET Framework | 100.0 - 100.15 |
.NET 5 | 100.10 - 100.12 |
.NET Core 3.1 | 100.7 - 100.12 |
Xamarin.Android | 100.0 - 100.15 |
Xamarin.iOS | 100.0 - 100.15 |
UWP | 100.0 - 100.14 |