I have an MVC solution, I want to refer to a sharepoint site and do a document search (.docx, .xlsx, .pptx, .pdf, etc.), also search for content within the documents and list the results in a view, but I don't know how to do this, I was researching on the crawled documents, the SPSite object and the Client Object Model, but I didn't find any example that works for me, I'm new to Sharepoint and I not planning to become a sharepoint developer just want to implement this functionality. Any advice on what is the best way to do this?. Thank you so much for your responses.
1 Answer
You would call the SharePoint web services or if using SharePoint Online, you could also call the Graph web services.
Here are some examples of the SharePoint web services:
https://yourServer/sites/yourSite/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&StartRow=1&RowLimit=100
With refinement filters:
https://yourServer/sites/yourSite/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='fileExtension:equals("docx")'&StartRow=1&RowLimit=100
Example using OR's:
https://yourServer/sites/yourSite/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='or(fileExtension:equals("docx"),fileExtension:equals("pptx"))'&StartRow=1&RowLimit=100