| Visual Basic (Declaration) | |
|---|---|
Public Overloads Function SearchItemsTaskAsync( _ ByVal searchParameters As SearchParameters _ ) As Task(Of SearchResultInfo(Of ArcGISPortalItem)) | |
| C# | |
|---|---|
public Task<SearchResultInfo<ArcGISPortalItem>> SearchItemsTaskAsync( SearchParameters searchParameters ) | |
This version of the Method obtains a Portal.SearchResultInfo<T> object that contains Portal.ArcGISPortalItem objects. Use the Portal.SearchResultInfo<T>.Results Property to get the IEnumberable collection of Portal.ArcGISPortalItem objects.
Portal.ArcGISPortalItems objects are user items, usually related to a specific area of interest such as maps (aka. WebMap), 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 Portal.SearchParameters to limit the scope of which items are returned. There is also another version of this Method that has the additional capability of using a search extent to find items that are within or intersect a supplied envelope, for more details see the Portal.ArcGISPortal.SearchItemsTaskAsync(SpatialSearchParameters) Method.
You can call this version of the Method before calling the Portal.ArcGISPortal.InitializeTaskAsync Method and obtain Portal.ArcGISPortalItem information BUT the Portal.ArcGISPortalItem.ArcGISPortal Property will not be populated with valid information (i.e. its value will be Nothing/null). It is a recommended best practice to call the Portal.ArcGISPortal.InitializeAsync Method before calling the Portal.ArcGISPortal.SearchItemsAsync Method so that all of the properties in the Portal.ArcGISPortal.ArcGISPortalItem will contain valid data.
You do not have to be a logged in user using the IdentityManager 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 Portal.PortalAccess level of Private you need to use the IdentityManager by supplying the appropriate username/password credentials. As AGOL and ArcGIS Portal require the use of long term tokens to access secured information (i.e. information that is Private) you should remember to set the IdentityManager.TokenGenerationReferer Property to the correct string required by your development platform.
By default the Portal.SearchParameters.QueryString 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 ArcGISPortalItem by it's Id: "id:00e5e70929e14055ab686df16c842ec1"
To find all WebMap ArcGISPortalItems with the word 'florida' in the Title field: "title:florida AND type:web map"
To find all Layer Package ArcGISPortalItems with the word 'florida' in the Title field: "title:florida AND type:layer package"
To find all ArcGISPortalItems with the word 'florida' in the Title field and the word 'esri' in the LicenseInfo field: "title:florida AND licenseinfo:esri"
To find all ArcGISPortalItems 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 ArcGISPortalItems 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 ArcGISPortalItems with a SpatialReference.WKID of 4267: "spatialreference:4267"
To find all ArcGISPortalItems 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 ArcGISPortalItems 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.
Parameters
- searchParameters
- The search parameters.
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8
Reference
ArcGISPortal ClassArcGISPortal Members
Overload List
SearchItemsTaskAsync(SpatialSearchParameters) Method
SearchItemsAsync(SpatialSearchParameters,Action<SearchResultInfo<ArcGISPortalItem>,Exception>) Method
SearchItemsAsync(SearchParameters,Action<SearchResultInfo<ArcGISPortalItem>,Exception>) Method