Monday, June 30, 2014

Extending External List Capabilities to Add and Edit List Items

In my previous article I mentioned how to create an external list using SharePoint 2013 to read list and read a particular list item. in this article I am planning to show how to allow adding new list items and editing list items which were disabled earlier.

I will be referring to the Visual Studio solution I created in previous article which can be found here. The step by step guide is as follows.

1. Double click on VSDemoModel to open the VSDemoModel.bdcm in the designer. The Entity1 object will be available. Select it. In the 'BDC Method Details' window you will find the 'ReadList' and 'ReadItem' methods. Scroll down the window till you find a cubic icon followed by a text '<Add a Method>'. 

Upon clicking on it, a drop down list will appear. Select 'Create creator method' option. A new method will be available as 'Create'. 

Thursday, June 26, 2014

Create an External List Using C#

In my previous 2 articles (Create SharePoint 2013 External List using Visual Studio 2012Extending External List Capabilities to Add and Edit List Items) I described how to create an External Content Type and create a list using that content type. 

In this article the focus will be on creating the list using C# rather using the SharePoint UI. Given the BDC Model goes in a farm level feature and create the external content type, the best option would have been writing the list creation code in the FeatureActivated method of the feature receiver. There are some issues I faced when creating this list. Given the BDC model deployment also associated with a feature receiver that is not visible, this was not possible to create a feature receiver for the feature that included the BDC model. There were some possible scenarios explained in some articles, but I did not follow them since there is another cleaner approach.

Therefore I created another feature and added a feature receiver for the second feature. The feature activation procedure needs to be done in an order. The second feature needed to be activated after the deployment of the first feature as the External Content Type needed to be presented before creating the list.

Thursday, June 19, 2014

Create SharePoint 2013 External List using Visual Studio 2012

Business Connectivity Services (BCS) are meant to provide access to data that relies out of the SharePoint environment. It can be a Web Service, SQL database, or even a .NET collection. The good thing about BCS is that it gives the real SharePoint feeling when external data is linked up with it. The data can be indexed to Search, Event Receivers(remote), Look and Feel, CRUD operations and etc... 

The important key element that comes with the BCS is 'External Content Type'. It handles the connectivity between SharePoint and external data source. 

The main focus of this article will be on how to deploy a BCS solution using Visual Studio 2013 for SharePoint 2013. 

1. Create a 'SharePoint 2013 - Empty' project in Visual Studio and name it as 'BCSVSDemo'. 

Click the 'OK' button and you will be navigated to the 'SharePoint Customization Wizard'. Mention the site URL and select the option 'Deploy as a farm solution'. Click 'Finish' button in order to complete project creation.