This post is a contribution from Chanchal Jain, an engineer with the SharePoint Developer Support team.
If you have a SharePoint Server installation and you have the SharePoint Search Application configured, you’ll be able to perform search in the SharePoint Search box. However when you perform a Search in the CMIS Consumer web part’s Search box, it’ll say no results returned unless your SharePoint site is already crawled by the Foundation Search. Yes that’s the default behavior.
The reason behind is CMIS Connector uses the SharePoint Foundation Search assembly to do search on SharePoint. (You read it correct!!). CMIS Connectors are not supported for SharePoint Foundation 2010. Refer SharePoint 2010 Administration Toolkit (SharePoint Server 2010).
So, assuming you haven’t already provisioned SharePoint Foundation search in your SharePoint farm, how do you make the CMIS Consumer web part search results working?
For CMIS Consumer Search to work, your site should be crawled by the SharePoint Foundation Search service. SharePoint does not provide any GUI to configure SharePoint Foundation Search which becomes “SharePoint Helper Search” in a Server Installation. Here’s are the steps to get your site crawled by SharePoint Foundation search:
- Open the Central Administration site of your farm.
- Navigate to Application Management –>Service Applications –> Manage Service Applications –>Search Service Application.
- Open the Content Sources configured for the Search Service Application.
- Remove the Site\ Web Application URL (the Producer site for your CMIS Consumer) which you want to be crawled by SharePoint Foundation Search Service from the Content Source.
- Start the Foundation Search Service from the System Settings –>Manage services on server –> SharePoint Foundation Search.
- Configure the Search and set the values as desired.
- Navigate to Application Management –>Databases –> Manage Content Databases.
- Select the Content Database for the CMIS Producer Web Application.
- Select the server where your Foundation Search Service is running for the “Search Server” property.
- Select the preferred Timer Jobs Server for “Preferred Server for Timer Jobs” properties
- Click on OK. Refer Image1 and Image2 for illustration on steps 7 – 10 below.
- Go to Monitoring –>Timer Jobs –>Review job definitions.
- Find the “SharePoint Foundation Search Refresh” and click on Run Now.
- After the job has run successfully, you will start seeing the results in the CMIS Consumer Search. But wait, your Enterprise Search would have stopped working.
- Now you can add your site or Web Application URL to the Content Source for your Search Service Application.
- Do a full crawl of the new added Content Source.
- So, now we have made SharePoint crawl my Content Source both in the Foundation Search and Enterprise Search and yes it’s a challenge!
If you have followed the above steps religiously, both your CMIS Consumer Search will start giving results as well as your code with contains query will start giving results.
NOTE: In case you are using search query to retrieve data from SharePoint 2010 using CMIS CONTAINS predicate and not getting search results back, the above steps could help too.
Even after performing the above steps if your code is unable to query SharePoint repository using the CMIS APIs the last thing you need to check is that in the imported project the URL of the web service is not that of FQDN name of server or Alternate Access mapping URL of the site.
e.g. your Site is hosted as http://Server:Port and the FQDN URL for the site is http://Server.Domain.com:Port and the Alternate Access Mapping URL is http://alternateurl.domain.com.
Your Service reference and the related configuration files in the code project should have the URL that you had added in the Content Source. i.e. http://Server:Port.
Hope this help the CMIS enthusiasts to connect to SharePoint!!!