Saturday, August 31, 2013

SharePoint 2013: How To Integrate BCS with Search


Check out the whole SharePoint 2013 Solution Series
New Titles Added Weekly!

Introduction

This post discusses the overall process of incorporating external data into SharePoint 2013 Search by leveraging Business Data Connectivity Services (BCS). I have an end-to-end solution that integrates product data from a SQL Server database into SharePoint 2013 by using external content types. This is covered in my Search Walkthrough Guide as well as my Enhancing the Search Experience Guide. However, the detailed steps are also available on their own within my SharePoint 2013 Solution Series guides. (Sorting and refinement only appear in the larger).


Step 1: Prepare the Data Source

The first step is to create your read list and read item procedures.
  • Create a stored procedure that returns all of the information you want to search and make sure all rows are returned. 
  • Create a stored procedure that returns the same information but only for a particular entity by using the ID as a parameter.

Step 2: Add Credentials to the Secure Store Service

In order for the External Content Type to be created and BCS to access your external data source, the data source credentials need to be stored. The Secure Store Service in SharePoint allows you to store credentials. For my scenario, a SQL database account was created named “AWDBAccount”. Therefore an entry in the Secure Store Service needs to be added for SQL Authentication.

Step 3: Create an External Content Type

The methods I describe in my books provides the steps for a no-code solution in creating an External Content Type that uses your data source as the provider of information via SharePoint Designer 2013.


Step 4: Set Permissions on the BCS Entity

I can imagine that this is often an overlooked step. Once the External Content Type is created, you need to give permissions to it, otherwise the search account as well as users will not be able to access the data.

Step 5: Create a Content Source for the External Content Type

In order to crawl the external data, you need to create a content source in Search.

Step 6: Create Managed Properties

After the crawl has completed, you now need to create managed properties and map them to the crawled properties from the new content source. This may be accomplished from the Search Service Application UI or from PowerShell. I describe both methods in my guide books.

Step 7: Create a Result Source

Step 8: Create a Result Type

Step 9: Create a Custom Search Results Page

Step 10: Add the Custom Search Results Page to the Search Navigation

Step 11: Test the Results


The results won't look too pretty. The remaining steps involve creating custom search display templates to properly present the external data search results.

Step 12: Create a Display Template

Step 13: Create an Item Hover Panel

Step 14: Update the Result Type to use the Display Template

Step 15: Test the Overall Results


Conclusion

In just 15 simple steps you can integrate external data into SharePoint 2013 Search by using external content types and BCS. You can get the entire end-to-end solution steps in my guides or from my SharePoint 2013 Solution Series:


Check out the whole SharePoint 2013 Solution Series
New Titles Added Weekly!

8 comments:

  1. Hi Steve,

    I purchased your Search Walkthrough ebook and follow BCS chapter but when I am doind full crawl of 'Product' I am getting this

    bdc3://adventure_works_2012_adventure_works_2012/Default/00000000%2D0000%2D0000%2D0000%2D000000000000/6/Adventure%20Works%202012/46&s_ce=04040202010001020408004008000

    Error while crawling LOB contents. ( Error caused by exception: Microsoft.BusinessData.Runtime.SsoAuthenticationException Message from External System : 'Credentials were not found for the current user within the target application 'AdventureWorksDB2012'. Please set the credentials for the current user.'. )

    I set all the accounts
    - Farm Account
    - Search/Crawl Account
    - AWDB Account

    Not sure why? Please advise

    Another error


    bdc3://adventure_works_2012_adventure_works_2012/Default/00000000%2D0000%2D0000%2D0000%2D000000000000/Adventure%20Works%202012/Adventure%20Works%202012&s_ce=0404020201000102040800g01001002000
    The parameter is incorrect.

    Please advise.

    ReplyDelete
    Replies
    1. Within the Secure Store Service, make sure you add credentials to the database for the Search/Crawl Account.

      Delete
    2. Hi Steve,

      Thanks for the information. I already added 'AWDBAccount' in Secure Store Service

      and

      as per your advise

      I visited Secure Store Service Application --> Select Target Application --> Click 'Set Credential' --> Provide Credential Owner --> Provide AD Search/Crawl Username (DOMAIN\ServiceAccountName) and Password & Confirm Password and click OK.


      Then

      Visited Search Service Application --> Content Sources --> Start Full Crawl on 'Products' Content Source but even getting the same error.
      "Credentials were not found for the current user within the target application 'AdventureWorksDB2012'. Please set the credentials for the current user."

      Please advise.

      Delete
    3. Set credential owner as the crawl account but the username and password needs to be the AWDBAccount

      Delete
    4. Thanks it works.
      It was missed in your Search Walkthrough ebook because in your book; 'SPAdmin' account was used for Credential Owner.

      Thanks any way.

      Regards

      Delete
  2. The book is a great guide - thanks.

    I'm doing this for the first time and find that the search results don't get limited to the AD group that I apply in step 4. Even people outside that group can see them.

    It is very possible I've messed up some detail somewhere so all I'm really looking for is confirmation that it should work - can we definitely restrict the results to members of an AD group without writing code?

    Thanks

    ReplyDelete
    Replies
    1. that group is for accessing BCS. the actual search results need to be security trimmed. I have never done it. I think I tried previously and it only worked for one account. I will need to look into this soon as I need the same thing.

      Delete
  3. Thanks for clarifying that, Steve.

    ReplyDelete

Matched Content