In this article we will be seeing how to create an External list using a console application in SharePoint 2010.Steps Involved:
namespace ExternalList{ class Program { static void Main(string[] args) { using (SPSite site = new SPSite("http:// sharepoint2010:4040/")) { using (SPWeb web = site.OpenWeb()) { string title="ExternalListTest"; string description="Creating External List through code"; SPListCollection listCollection = web.Lists; SPListTemplateCollection tempCollection = web.ListTemplates; SPListDataSource ds = new SPListDataSource(); ds.SetProperty("Entity", "Employee"); ds.SetProperty("EntityNamespace", "BdcModelUsingOracle.BdcModel1"); ds.SetProperty("LobSystemInstance", "BdcModel1"); ds.SetProperty("SpecificFinder", "ReadItem"); Guid gd = listCollection.Add(title, description, "", ds); listCollection[gd].Update(); SPList list = web.Lists[title]; list.OnQuickLaunch = true; list.Update(); Console.WriteLine("External List Created Successfully"); } } } }}
Open the SharePoint site http:// sharepoint2010:4040/ (the Url mentioned in the code).
You can see an External List as shown in the following.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: