SharePoint 2013 – Develop a Publishing portal using BCS, Enterprise Search and Content Search Web Part

I am going to walkthrough here that how to develop a publishing portal using external data. Instead of using an Adventure works or Contoso databases, I am going to use the data from http://themoviedb.org. The ultimate goal is, how to utilize the SharePoint 2013 enterprise features in the entire post series.

Here is the entire data model for the movie portal.

db-model-18-aug-2013

First we target the “Movie” table. The following steps are involved to complete the task. I have attached all the related scripts at end of this post.

18-aug-2013-steps

The final output of the post is,

18-aug-2013-content-search-webpart

Step 1: Create source database and publishing portal

First, execute the script file “script.sql” to create the database “MovieDemo”. After executing the script file, the following items will be provisioned in the “MovieDemo” database.

1. Movie table (with 10 rows)

2. GetMovie View

Now the database is ready and we will create the site collection “Movie Portal” using publishing template.

Step 2: Create external content type using SharePoint Designer

We will see that how to create the External Content Type (BCS) using SharePoint Designer 2013.

  1. Open the SharePoint 2013 Designer using movie portal URL.
  2. Select the “External Content Types” in the left navigation and then click “External Content Type” in the top navigation
  3. Enter the name as “Movie” and click the link “Click here to discover external data sources and define operations”
  4. Click “Add Connection” select the data source type as “SQL Server” and fill the  database server name and database name.
  5. Now expand the view “GetMovie”, right click and  select “New Read Item Operation”, finish this steps with default values .
  6. Again right click and select “New Read List Operation”, finish this steps with default values.

18-aug-2013-external-content-type

Step 3 : Create the Action URL

  1. Open the Central Administration and navigate to Manage Service Applications –> Business Data Connectivity Service
  2. Select the external content type “Movie” and set the permissions using the top navigation “Set Object Permissions” and “Set Metadata Store Permissions” (Read and Execute)
  3. Select the item “Movie” and click “Add Action” in the context menu and create the “Add Action” for external content type “Movie” with the following values.

18-aug-2013-add-action

Step 4: Create the search content source

  1. Open the Central Administration and navigate to Manage Service Applications –> Search Service Application
  2. Select the Content Sources in the left navigation
  3. Click the “New Content Source” using name as “MP-MOVIE” and External Data source as “BCS” and select the BCS connection name.
  4. Click the “MP-MOVIE” content source and then select “Start Full Crawl”
  5. Check the log if crawl is not working as expected. 
  6. Now navigate to publishing portal and try search with some keyword, we will get the following output.

18-aug-2013-search-result

Step 5-8: Retrieve the list of crawled properties

Now we can able to see the external data inside the search results. But we need to create the Managed Properties, if we want to represents the external content type data inside the SharePoint webpart like below.

18-aug-2013-content-search-webpart

For creating a Managed Properties through UI, navigate to Search Service Application and Select the “Search Schema”. We can create the same through power shell scripts.

  1. Open the “Windows Powershell ISE”
  2. Open and execute the “GetCrawledProperties.ps1” script and it will return the list of crawled properties which is related to “Movie” external content type.

    18-aug-2013-crawled-properties

  3. Based on this crawled properties, I have created “Properties.xml” file. Here I have mentioned list for crawled items as well as list of new “Managed Properties” which is related to “Movie” external content type and finally I have mentioned mapping between the crawled properties and the managed properties.
  4. Now open and execute the script file “CreateSchemaProperties.ps1” and pass the argument as “Properties.xml” file path.
  5. Now navigate to Search Service Application –> Search Schema and you can see the newly created Managed Properties with proper mapping.

    18-aug-2013-managed-properties
  6. Again navigate to content source and start the full crawling.

                                          Step 9 : Create the category page and item page

                                          1. Open the publishing portal
                                          2. Navigate to Settings –> Add Page, create the new page called “Movie” without file extension.
                                          3. Navigate to Site Contents –> Pages, create the new page called “Movie-view.aspx”

                                          Step 10: Create the Search Result Sources

                                          1. In the publishing portal, navigate to Search Result Sources.
                                          2. Create the new Result Source with name as “Movies” and query transform as “{searchTerms} contentsource:MP-MOVIE”
                                          3. In the Query Builder, we can execute and see the results.

                                          Step 11: Create the user friendly URL

                                          1. In the publishing portal, navigate to Term Store Management
                                          2. Set the following values like below.

                                          18-aug-2013-term-store-mgnt

                                          Step 12-13: Configure the Content Search WebPart

                                          1. Now navigate to movie page using the URL http://sp2013:80/movie (change using your site collection)
                                          2. Edit this page and add the Content Search webpart from Control rollup category
                                          3. Edit the content search webpart and click the “Change Query” button
                                          4. In the BASICS tab, click the “Switch to Advanced Mode” and the select a query “Movies”
                                          5. See the result in the preview window.

                                            18-aug-2013-execute-query

                                          6. Set the following values in the edit property window.

                                            18-aug-2013-execute-query1

                                          7. Now the list of movies will be visible in the screen.
                                          8. Now click any one of the movie item and it will redirect to http://sp2013dc/movie/tt0266543 
                                          9. Like movie page, edit and add the content search webpart
                                          10. In Change Query, advanced mode, Select a query as “Movies” and Query text as “MovieImdbId:{URLToken.1}”
                                          11. Now we can see the single movie at the preview window.
                                          12. And fill the other properties like below,18-aug-2013-execute-query2

                                          Conclusion

                                          In  the next post, I will cover how to deploy using visual studio 2013 and display template customization. Please write me If you have any question regarding this post.

                                          Download Source

                                          Comments (1) -

                                          Rachael lane
                                          Rachael lane
                                          9/26/2013 4:19:21 PM #

                                          Hi

                                          Great post.  Was wondering if you can provide me some insight or point me to the right resource for the following:

                                          I have an external list which I would like to provide a filter/search functionality for.  I had planned to use the approach outlined here:  office.microsoft.com/.../...-part-HA101791813.aspx where I place an HTML Web Form web part and an list view web part of the external list on to the page.  I connect the 2 web parts with the form web part providing whatever the user enters to the list view web part.  However, this does not seem to work for external lists (this does work for SharePoint lists/libraries).  Is there any other out-of-the-box approach?

                                          Thanks in advance
                                          Rachael

                                          Pingbacks and trackbacks (2)+

                                          Add comment

                                            Country flag

                                          biuquote
                                          • Comment
                                          • Preview
                                          Loading

                                          About Me

                                           

                                          I am a SharePoint Architect/ Consultant

                                          Month List