This SharePoint tutorial explains, how to create an external content type based on the stored procedure in SharePoint 2013/2016 using BCS (Business connectivity services).
I have a requirement wherein I will be using an External Content Type (BCS) using a Stored Procedure.
The stored procedure has parameters.
I have to set up Read List and Read Item operations.
The objective of this tutorial is to write a Stored Procedure that returns a list of SharePoint History from the SharePoint Test database and displays these results by using the Business Data List web part. We will also see how we can use various filters (ID for our example) to limit the result set returned by the stored procedure.
Create External Content Type in BCS SharePoint
In this step, we will use SharePoint Designer to create an External Content Type from the stored procedure created in the previous step.
Browse to the “SharePoint – 80” site in your development environment.
On the Site Actions drop-down, click Edit in SharePoint Designer.
In the Navigation pane, click External Content Types.
In the New group of the ribbon, click External Content Type.
In the External Content Type Information group, edit each of the parameters as below and leave the remaining to their default settings.
|Display Name||SharePoint History|
Next to External System, click Click here to discover external data sources and…
In the Data Source Explorer, expand the SharePoint Test to find the stored procedure sp_Sharepoint_History under the Routines node.
Right-click on sp_Sharepoint_History to open a pop-up menu and click New Read List Operation.
Click the Next > button at the bottom of the Read List dialog.
On the Input Parameters page, click @ID in the Data Source Elements pane.
In the Properties pane, edit the values as below. Then, click Click to Add against the Filter property.
In the Filter Configuration dialog, select New Filter. Edit the properties as below leaving the rest to their default. Then click OK.
Click the Next> button at the bottom of the Read List dialog.
On the Return Parameters page, click ID in the Data Source Elements pane.
In the Properties pane, check the box for Map to Identifier and Show In Picker.
Click the Finish button. Click the Save button in the Quick Access Toolbar to commit the changes.
Navigate to your SharePoint 2013 site.
From this page select the Site Actions | Edit Page.
Click on Add a Web Part, in the left web part zone.
From the web parts selection menu, select Business Data in the Categories section and then from the list of web parts select Business Data List and click add.
From the web part’s action menu, click on Edit Web Part to open the tool pane for this web part.
In the Business Data List section of the edit pane, click on the picker icon next to Type field to bring up the External Content Type Picker dialog form.
In the dialog form, select the content type created in the previous steps and click OK.
For the View Property, select Default (SharePoint History Read List) in the dropdown.
Then click OK in the web part’s tool pane.
You may like following Business connectivity services tutorial:
- Business Connectivity Services BCS in SharePoint 2010
- Creating Business Data Connectivity Service using SharePoint Designer 2013 in SharePoint 2013
- Fix Login Failed For User NT AUTHORITY\IUSRS in Business Connectivity Services for SharePoint 2013
- The metadata object that has Name has a Property with name ‘AuthenticationMode’ and value ‘RevertToSelf’
- There are no addresses available for this application error Message while configuring BCS SharePoint 2013/2016
- SharePoint 2013 BDC Configuration and Creating External Content Type and External List
Now we have seen how to configure the External Content Type and Business data List Web Part to make BCS look like SharePoint List.
Solutions. I am currently working on Sharepoint 2010, MOSS 2007, Sharepoint 2013,Sharepoint 2013 App Dev, C#, ASP.NET, and SQL Server 2008.
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.