用SharePoint Designer 创建Business Data Connectivity Service进行外部数据的连接

SharePoint中可以自定义外部数据连接,具体方法可以分为两种:一种是用SharePoint Designer进行无代码创建,另一种是通过VS进行有代码的实现,下面的这篇文章主要讲解最简单的无代码创建过程,并且是SharePoint连接Sql Server数据源。

第一步:在Sql Server中创建数据库以及用到的数据库表

1):在Sql Server中创建相应的数据库EricSunDB,并且创建对应的一个表Product【主键:ProductID为int型并且自增长,ProductName和ProductDescription都为nvarchar】。具体创建过程不过多讲解,请看如下截图。

第二步在CA中创建一个Secure Store Service Application(此步骤可以省略)

1):在CA中的Manage Service Applications --> Secure Store Service --> Generete New Key

2):在上一步的Secure Store Service中New 一个对应的Application(即:点击New按钮)

3):点击Next填写相应的数据即可,创建完的结果请看如下图:

第三步:在SharePoint Designer中创建一个对Sql数据库的连接

1):打开SharePoint Designer,选择External Content Types --> 点击上面一排Ribbon中的External Content Types 如下图所示

2):点击上图中画红线的连接External System(Click here to discover external data sources and define operations.) 去创建一个Connection,即点击Add Connection 然后 data source中的Type 选择 SQL Server,填写正确的信息,创建出一个名叫:EricSunSqlConnection 的连接

3):下图表示创建完Connection之后的效果

3):展开创建好的Sql Connection,定位到数据库中Product表,点击右键选择Create All Options,并进行相应的配置,保存整体的设置

---》 进行配置 

第四步:在CA中的Business Data Connectivity Service进行配置

1):View External Content Types

2):Set Object Permission

3):Set Metadata Store Permission

4):Create Update (之后Default Action就有值了)

 第五步:去SharePoint中创建一个External 类型的List

1):创建External 类型的List

 2):选择对应的External Content Type

3):去该List中看效果,Item对应了数据库中的记录,双向实时更新

原文地址:https://www.cnblogs.com/mingmingruyuedlut/p/2784412.html