OneDrive/ODConnection.public.cs
/// <summary>
/// Search for items matching a given search query
/// </summary>
/// <param name="rootItemReference"></param>
/// <param name="searchQuery"></param>
/// <param name="itemRetrievalOptions"></param>
/// <returns></returns>
Search for items matching a given search query
Search for items matching a given search query
public async Task<ODItemCollection> SearchForItemsAsync(ODItemReference rootItemReference, string searchQuery, ItemRetrievalOptions itemRetrievalOptions)
        {
            if (!rootItemReference.IsValid())
                throw new ArgumentException("rootItemReference was invalid. Requires either an ID or Path");
            if (null == searchQuery)
                throw new ArgumentNullException("searchQuery");
            if (null == itemRetrievalOptions)
                throw new ArgumentNullException("itemRetrievalOptions");
            var queryParams = ODataOptionsToQueryString(itemRetrievalOptions);
            queryParams.Add(ApiConstants.SearchQueryParameterKey, searchQuery);
            Uri serviceUri = UriForItemReference(rootItemReference, ApiConstants.SearchServiceAction, queryParams);
            var request = await CreateHttpRequestAsync(serviceUri, ApiConstants.HttpGet);
            return await DataModelForRequest<ODItemCollection>(request);
        }
public async Task < ODItemCollection > SearchForItemsAsync ( ODItemReference rootItemReference , string searchQuery , ItemRetrievalOptions itemRetrievalOptions ) { if ( ! rootItemReference . IsValid ( ) ) throw new ArgumentException ( " " ) ; if ( null == searchQuery ) throw new ArgumentNullException ( " " ) ; if ( null == itemRetrievalOptions ) throw new ArgumentNullException ( " " ) ; var queryParams = ODataOptionsToQueryString ( itemRetrievalOptions ) ; queryParams . Add ( ApiConstants . SearchQueryParameterKey , searchQuery ) ; Uri serviceUri = UriForItemReference ( rootItemReference , ApiConstants . SearchServiceAction , queryParams ) ; var request = await CreateHttpRequestAsync ( serviceUri , ApiConstants . HttpGet ) ; return await DataModelForRequest < ODItemCollection > ( request ) ; }
Search for items matching a given search query
Search for items matching a given search query
None
rootItemReference
ODItemReference
None
searchQuery
string
None
itemRetrievalOptions
ItemRetrievalOptions
None