Esempio n. 1
0
        /// <summary>
        /// Executes a SOSL search, returning a simple generic object in the results collection that primarly results in a list of object IDs
        /// </summary>
        /// <param name="searchString"></param>
        /// <returns>SearchResult{SObjectGeneric}</returns>
        public async Task <SearchResult <SObjectGeneric> > Search(string searchString)
        {
            try
            {
                var uri = UriFormatter.Search(InstanceUrl, ApiVersion, searchString);

                JsonClient client = new JsonClient(AccessToken, _httpClient);

                SearchResult <SObjectGeneric> searchResult = await client.HttpGetAsync <SearchResult <SObjectGeneric> >(uri);

                return(searchResult);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error searching: " + ex.Message);
                throw ex;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Executes a SOSL search, returning a simple generic object in the results collection that primarly results in a list of object IDs
        /// </summary>
        /// <param name="searchString"></param>
        /// <returns>SearchResult{SObjectGeneric}</returns>
        public async Task <SearchResult <SObjectGeneric> > Search(string searchString)
        {
            try
            {
                Dictionary <string, string> headers = HeaderFormatter.SforceCallOptions(ClientName);
                var uri = UriFormatter.Search(InstanceUrl, ApiVersion, searchString);

                JsonClient client = new JsonClient(AccessToken, _httpClient);

                SearchResult <SObjectGeneric> searchResult = await client.HttpGetAsync <SearchResult <SObjectGeneric> >(uri, headers);

                return(searchResult);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error searching: " + ex.Message);
                throw;
            }
        }