0

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.

  • How are you handling security? Do you want the MVC app to assume the security context of the logged in user, or is a service account identity ok? – Derek Gusoff Oct 11 '19 at 18:24
0

You would call the SharePoint web services or if using SharePoint Online, you could also call the Graph web services.

https://docs.microsoft.com/en-us/sharepoint/dev/general-development/sharepoint-search-rest-api-overview

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.