SPD External Content Type from WCF

 SharePoint 2010.

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 .

Open your IIS manager, navigate to the site which hosts your WCF service, and make sure it is running.

WCFIIS thumb SPD External Content Type from WCF 

[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.

WCFRun thumb SPD External Content Type from WCF

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’

Step3 thumb SPD External Content Type from WCF

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

Step4 thumb SPD External Content Type from WCF

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

NewECT thumb SPD External Content Type from WCF

7, Upon clicking this button you’ll be presented with the screen to edit and manage your External Content Type.

Step7 thumb SPD External Content Type from WCF

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:

Name: Contacts
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

Step8 thumb SPD External Content Type from WCF

9, Choose the data source type to be WCF Service and click on OK button.

DS thumb SPD External Content Type from WCF

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

WCFSettings thumb SPD External Content Type from WCF 

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.

WebMethods thumb SPD External Content Type from WCF

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.

WCFFinder thumb SPD External Content Type from WCF

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.

WCFRetParamConfig thumb SPD External Content Type from WCF

15, Right click on GetContactsSpecificFinder and choose “New Read Item” operation.

WCFSpecific thumb SPD External Content Type from WCF

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.

WCFInput thumb SPD External Content Type from WCF

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.

WCFSpecificRet thumb 1 SPD External Content Type from WCF

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.

WCFBCSMethods thumb SPD External Content Type from WCF

19, Press “CTRL+S” to save the External Content Type.

WCFECT thumb SPD External Content Type from WCF

20, We can open SharePoint and create External List on Contacts external content type.

WCFList thumb SPD External Content Type from WCF

21, It will call the “Read List”(Finder) WCF method and populate the records.

WCFListFinder thumb SPD External Content Type from WCF

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.

WCFSpecList thumb SPD External Content Type from WCF

ListSpec thumb SPD External Content Type from WCF

 

If you have any questions about this walk through please feel free to leave a comment or email support@lightningtools.com

<hrayr/> 

  1. Thanks for such a beautifully composed, informative article.I think your work to this is really great .
    I really appreciate your work to this site. this blog is really very informative and it helps me lot.

     
  2. Aris

    How about updater or creator ? i just create the updater and creator but it’s not work.
    My problem is sharepoint not create the update/create forms.
    if you have a working updater/creator, please let me know. Thanks a lot. :)

     
  3. great and good Article, no doubt that Writer has made hard work for this.

     
  4. JK

    Excellent!!

     
  5. Vitor

    How can i create input parameters based on the wcf connector ?
    I need to create a interval date time filter based on the read list return objects.

    Thks in advance!

     
  6. Thanks for a nice share you have given to us with such an large collection of information. Great work you have done by sharing them to all. simply superb.

     
  7. Amir

    Hello,

    I want to define an updated method that takes the ID as an identifier and the firstname as an input parameter. I am not able to do that as it gives me error that the list does not support updating existing items. Any ideas?

     
  8. Jorge

    I just am working with external list and your post was very helpful, however I have a little issue about deployment process.

    As said, the connection to WCF is configured from SharePoint Designer.

    In my case, three environments are keeping (development, pre-production and production).

    How should I proceed in order to display each external content type considering that “Service Metadata URL” field is different in each environment?

    Very thanks for you collaboration.

     

Leave a Comment

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

*