In this walkthrough we will create an External Content Type in SharePoint Designer based off a WCF services. Please follow the below steps to accomplish that.
1, Make sure your WCF services is hosted and is available to use. For this walkthrough we have used BDC Web Man to generate the WCF service for the Contacts table in AdventureWorks2000 database. BDC Web Man is a tool that can save you a lot of time as it generates all the c# code your WCF service will need in a way that the BCS can easily use. As of writing BDC Web Man only generates the Finder, Specific Finder, ID Enumerator and Association methods, so if you want to create more BCS Methods (e.g. Creator or Updater), you should add the appropriate web methods manually. For more information about the BDC Web Man, please visit http://lightningtools.com/bdc-web-man/default.aspx .
[please click the images for a larger view]
2, Open Internet Explorer and navigate to the .svc file. You should see appropriate page which shows that the WCF service is working.
So, now we are sure that our WCF service is hosted and runs OK. Now we can create our External Content Type in SPD based off this WCF service.
3, Open up SharePoint Designer 2010 and click the big button to ‘Open Site’
4, Enter the URL of your SharePoint site and press enter. SharePoint Designer will now connect and bring back the relevant information about that site. Below you can see the nice site Dashboard view that gives you a quick overview of your SharePoint site
5, Down the left side menu you’ll see the various SharePoint objects you can work with via SharePoint Designer, and the new object type we are interested in is External Content Types. When you click this menu item you’ll get a view of the other External Content Types deployed and also the Ribbon menu at the top of SharePoint Designer will change to reflect the work we can do with it.
6, In the Ribbon, click to create a new External Content Type
7, Upon clicking this button you’ll be presented with the screen to edit and manage your External Content Type.
There are a number of labels that look like Hyperlinks that you can click to set their value. The first two are Name and Display Name. Set these values to be:
Display Name: Contacts
The Office Item Type will allow you to map your External Content Type to commonly used Microsoft Office objects such as Contacts or Calendar events. We’ll have a blog post on how to utilize these shortly.
For now we just need to choose an external data source to connect to. Click on the link ‘Click here to discover external data sources and define operations’
8, Clicking the link above opens up the Operation Designer view. Click on the button to Add Connection
9, Choose the data source type to be WCF Service and click on OK button.
10, The WCF connection window will open. Here we need to apply information about our WCF service, so SharePoint Designer can connect to it.
In step 2, there is a screenshot and in red rectangle you can find out the URL which needs to be used as MetaData URL in the WCF connection windo
w. In this walkthrough we used the following URLs for MetaData and Enpoint configuration.
Metadata URL: http://win-74y1750o0mq:4445/Service.svc?wsdl
EndPoint URK: http://win-74y1750o0mq:4445/Service.svc
11, When the WCF connection is configured you can click on OK button and it will try to connect to your WCF service. If everything is ok, then it will show you the available web methods.
12, When Web methods are populated, we should create appropriate BCS operations. In our example, we will use GetContactFinder as “Read List” operation, and GetContactsSpecificFinder as “Read Item” operation.
13, Right click on GetContactFinder and choose “New Read List” operation.
14, Upon selecting the operation our WCF method is the Operation Properties window will open. In “Return Parameters” section you will notice the error message that “At least one identifier should be specified”. Choose “ContactID” and in the right panel tick the checkbox “Map To Identifier”. In Identifier combo box select the “ContactID”. Click on Finish button and “Read List” operation will be created.
15, Right click on GetContactsSpecificFinder and choose “New Read Item” operation.
16, In Operation Properties window, in the “Input Parameters” section we need to map the input parameter to the identifier. Select contactid and in the right panel tick the checkbox “Map to Identifier” and select the ContactID from the Identifier combo box. Click on the Next button.
17, The Return Parameters section also contains an error messages regarding the identifier mapping. To fix these errors, in the left panel choose “ContactID” and in the right panel tick the “Map to Identifier” checkbox and select the “ContactID” in the Identifier combo box. Click on Finish button.
18, Now, at the right hand side of your External Content Type screen you can see the operations that we have defined. You can add other operations as well, e.g. Creator,Updater,etc.
19, Press “CTRL+S” to save the External Content Type.
20, We can open SharePoint and create External List on Contacts external content type.
21, It will call the “Read List”(Finder) WCF method and populate the records.
22, Select any item and click on “View Item” ribbon, it will call “Read Item”(Specific Finder) method and view the selected item in new dialog.
If you have any questions about this walk through please feel free to leave a comment or email email@example.com