sharepoint search api
5 TopicsSharePoint Search API result returns unexpected RowCount
Hi I am struggling to understand why the following request https://%xyz%.sharepoint.com/_api/search/query?querytext='marco'&rowsperpage=10&rowlimit=200&clienttype='ContentSearchRegular' Results in a row count of 2 whereas https://%xyz%.sharepoint.com/_api/search/query?querytext='marco'&startrow=1&rowsperpage=10&rowlimit=200&clienttype='ContentSearchRegular' Results in the expected row count of 10 Initially the first query worked fine (since 2017) and the unexpected result is new. Therefore I believe it may be related to an update by Microsoft. Curious to see if anyone else is experiencing the same thing! PS What is also odd is that for other queries e.g. 'sharepoint' I get immediately 10 rows of results.1.1KViews0likes0CommentsSharePoint Search results to CSV
I have a use case where I want end-users to be able to use SharePoint Search to perform searches and then export those search results to a CSV file. I found many examples online explaining how to translate the criteria the user enters into the Search Search textbox into an API request. My problem, however, is that those examples often fail when the user clicks one or more of the left-hand refiners because the new resultset is often a combination of the user's querytext and the left-hand refiners they select. The UX I am hoping for is: User goes to the SharePoint Search page. Performs a search. Refines the results using the left-hand refiners. Clicks "Export results to Excel". I am a software developer, so I can develop almost anything we need (i.e. embed javascript on the page, build proxy APIs, etc.). I just need some advice on capturing the querytext AND refiners the end-user selected on the SharePoint Search page so I can replay that same query to the SharePoint Search APIs to eventually generate the CSV extract I am looking for. So far, I've tried capturing the query from the URL. https://sharepoint2019.domain.local/search/Pages/results.aspx?k=smith&ql=1033#Default=%7B%22k%22%3A%22smith%22%2C%22r%22%3A%5B%7B%22n%22%3A%22FileType%22%2C%22t%22%3A%5B%22equals(%5C%22odp%5C%22)%22%2C%22equals(%5C%22ppt%5C%22)%22%2C%22equals(%5C%22pptm%5C%22)%22%2C%22equals(%5C%22pptx%5C%22)%22%2C%22equals(%5C%22potm%5C%22)%22%2C%22equals(%5C%22potx%5C%22)%22%2C%22equals(%5C%22ppam%5C%22)%22%2C%22equals(%5C%22ppsm%5C%22)%22%2C%22equals(%5C%22ppsx%5C%22)%22%5D%2C%22o%22%3A%22or%22%2C%22k%22%3Afalse%2C%22m%22%3Anull%7D%5D%2C%22l%22%3A1033%7D When I decode Default below is what I get, which appears to have the user's text input and the refiners they've selected: { "k": "smith", "r": [ { "n": "FileType", "t": [ "equals(\"odp\")", "equals(\"ppt\")", "equals(\"pptm\")", "equals(\"pptx\")", "equals(\"potm\")", "equals(\"potx\")", "equals(\"ppam\")", "equals(\"ppsm\")", "equals(\"ppsx\")" ], "o": "or", "k": false, "m": null } ], "l": 1033 } My problem is that I can't find a way or API to which I can send this payload that will perform the same search against the SharePoint Search APIs (which I intend to use in a proxy API to generate the CSV in the desired format). If I am going about this wrong, I'm happy to scrap this approach and perform the search another way. The important thing, however, is that the user needs to perform the search via the SharePoint Search page. They must also be able to use the left-hand refiners to refine their results further. Any ideas on achieving the desired outcome would be much appreciated. This is for a SharePoint 2019 on-premise installation.928Views0likes0CommentsSharePoint Pagination using Index Doc Id does not allow sorting on Created on columns
Hi All, We are using SharePoint Search API to get the items from SharePoint List. We have a large dataset so we are following the below approach for pagination as mentioned in the MS Documentation below. https://docs.microsoft.com/en-us/sharepoint/dev/general-development/pagination-for-large-result-sets It is sorting on DocId. But we also have to sort based on the created on Date, I am using below API. API: https://site/_api/search/query?querytext='test ListId:0ae14d29 indexdocid >10'&sortlist='refinabledate00:descending,[docid]:ascending'&rowlimit=10 but when I try to get results for page 2 it is not giving me the correct result. It gives the same set of records as on page 1. If I retrieve records without createdOn sorting I am getting correct records but we want sorting based on date as well.889Views0likes0CommentsHow to use SharePoint search query with SharePoint Granular access permissions?
I want to execute SharePoint search API with granular access for that I've changed 'Sites.ReadWrite.All' permission to 'Sites.Selected' permission, so that application would have all sites access but during search I'm getting unauthorize error ``` {"odata.error":{"code":"-1, Microsoft.Office.Server.Search.REST.SearchServiceException","message":{"lang":"en-US","value":"Unauthorized."}}} ``` Also tried to give sites.selected permission at tenant level, that also not works, if the only solution is to give 'Sites.ReadWrite.All' or 'Sites.Read' then there is no use of granular level access implementation Sites.Read.all will allow all sites if granted. My query is similar to below -: https://tenant.sharepoint.com/_api/search/query?querytext='*+AND+(Path:"https://tenant.sharepoint.com/sites/SITE1/RECORDS" OR Path:"https://tenant.sharepoint.com/sites/SITE2/RECORDS")'&trimDuplicates=false&selectProperties='Column1,Column2'&refiners='Column1OWSTEXT'&refinementFilters='Column1:equals(\"xxxxx\")'&rowLimit=5 Some other references regarding my question. https://sharepoint.stackexchange.com/questions/306397/how-to-use-sharepoint-search-query-with-sharepoint-granular-access-permissions?newreg=dbcbb62ae019481c9a864f537ecd0faf https://sharepoint.stackexchange.com/questions/306432/is-that-sites-selected-permissions-level-allows-the-sharepoint-online-global Really appreciate any response on this or alternative approach to to achieve this.794Views0likes0CommentsMulti Select Person or Group as filter in custom vertical is not parsed as single value in MS Search
I've created a custom search vertical under Microsoft Search settings in a modern SharePoint Online site collection. There are couple of fields which are multi select Managed Metadata and Person or Group fields. The data is stored in them in the format which is given as follows: Company (Managed Metadata) - ABC Inc; XYZ Pvt Ltd Author (Person or Group) - User1;User2 (display names) The above 2 fields are used as filters and the respective RefinableString managed properties are used with corresponding crawled properties. Company - OWS_Company (managed metadata), OWS_Company2 (lookup), OWS_CompanyName (multiple lines of text) Author - OWS_Author When we try to filter the search results, the available options in the dropdown are shown in the format that is stored in the library instead of showing single values for the person or group column and it displays correct values (single values) for the managed metadata field. Current Format Company ABC Inc XYZ PVt Ltd Author User1;User2 Desired Format Company ABC Inc XYZ PVt Ltd Author User1 User2 The Company field's (managed metadata) managed property has 3 fields crawled properties mapped to it of type Managed Metadata, Lookup and Multiple lines of text whereas the Author (person or group) field only has one crawled property of type person or group. Based on PnP Community support and a related reddit thread, this is a search API issue for which the fix has been rolled out few months back but we are currently still seeing this issue. Any thoughts or ideas on how to resolve this? https://github.com/microsoft-search/pnp-modern-search/issues/2096 https://www.reddit.com/r/sharepoint/comments/uvv3vw/sharepoint_online_multiuser_refinement_tokens_too/777Views0likes0Comments