I want to create an external list in SharePoint via API data.

My questions are as follows:

1- How to create external list in SharePoint via API data?

2- when user updates item in SharePoint, how can I know those fields and items that edited by users? version history is one option. Any options are preferable?

1 Answer 1

  1. We can use the code below to create external list.

    SPListDataSource ds = new SPListDataSource();
    ds.SetProperty(SPListDataSource.BDCProperties.LobSystemInstance, "Demo Customers");
    ds.SetProperty(SPListDataSource.BDCProperties.EntityNamespace, "http://intranet");
    ds.SetProperty(SPListDataSource.BDCProperties.Entity, "Demo Customers");
    ds.SetProperty(SPListDataSource.BDCProperties.SpecificFinder, "CustomerRead Item");
    using (SPSite site = new SPSite("http://intranet"))
        using (SPWeb web = site.RootWeb)
            web.Lists.Add("Demo Customers", "Demo Customers", "Lists/DemoCustomers", ds);


  2. Version history is a good option to achieve your requirement, we can also use event receiver to monitor the user changed for the list item.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.