Visual Studio 2010 helps a SharePoint developer to develop, debug and deploy .NET assemblies as external data sources to SharePoint. In the following paragraphs, I will walkthrough with you how to create your first SharePoint external list using Visual Studio 2010.
1. Create a new BDC Model project. (Main menu: File -> New -> Project…). In the left column of the New Project dialog, you are able to find node 2010 under tree view Visual C# -> SharePoint. Similarly you can find same node under Visual Basic -> SharePoint. In the middle column of the dialog, you should be able to see Business Data Connectivity Model listed as one of the project templates. See the screenshot as follows. Here I am creating BDC Model project in Visual C#. You are able to do the same things in Visual Basic.
2. After clicking [OK] button in the New Project dialog, the SharePoint Customization Wizard dialog will be displayed. In this dialog you can customize the local site you want to target and trust level for the SharePoint solution. Since a BDC model is deployed to a farm, a collection of one or more SharePoint servers and one or more SQL servers, only “Deploy as a farm solution” option is enabled. Here is the screenshot of the dialog.
3. When you click [Finish] button in the SharePoint Customization Wizard dialog, the BDC Model project will be created. There are four main UI panes that help you manage the BDC model visually. They are the BDC Designer Surface, BDC Method Details Pane, BDC Explorer, and Properties Browser.
- The BDC Designer Surface allows editing entities, identifiers, methods, and associations between entities. And you can do that either from toolbox or context menus.
- The BDC Method Details pane, where its name is already self-explanatory, lets you edit everything related to a method, from the method itself, its parameters to its parameters’ type descriptors, from method instances to filter descriptors, etc.
- BDC Explorer lists and organizes metadata objects in the BDC model in a tree view. It lets you to browse and search metadata objects in a graphical way and allows you to copy/cut/paste type descriptors between different parameters or type descriptors.
- Properties Browser gives you a familiar way of editing components and attributes of BDC Models. We use it to supplement the functions offered by the other three panes and list all the attributes for a particular metadata object for editing. Here is a typical layout of a BDC Model project as described above.
4. If you notice, there is already a default entity generated for you when the project is created. This default entity also has an identifier and two methods ReadItem and ReadList created. One is a Finder method that is to return a collection of data. The other is a Specific Finder method that is to return a specific entry based on the input parameter(s).
5. Now let’s deploy to the SharePoint server. You can either click the deploy menu item in main menu (Build -> Deploy Solution), or in the context menu of the project or the solution. In the output you will see several activities happening including packaging, solution retraction/addition, deployment, etc.
6. Let’s open the target site and see if our model has been successfully deployed. Open the target site with any browser supported by SharePoint, like Internet Explorer 8. Create an external list based on the model we just deployed. Here are the steps to create an external list in case you are new to it.
- In main menu: Click Site Actions -> More Options…
- On the Create dialog, select External List, click [Create] button in the right column
- On the next external list create form, type a name for the list. Check ‘Yes’ to display the list on the Quick Launch for easy access. Then click to select the model we just deployed in the External Content Type Picker form. Click [Create] on the external list create form. Now the Hello World list is displayed.
In the main menu under List Tools -> Items, you may find only “View Item” option is enabled. Guess why? Yes, it is because the default entity only has a Finder method to view the entire list and a Specific Finder method to view a specific item.
SharePoint 2010 User’s Guide: Learning Microsoft’s Business Collaboration Platform (Expert's Voice in Sharepoint)
No comments:
Post a Comment