zoukankan      html  css  js  c++  java
  • 如何:在 SharePoint 中创建外部列表

    在创建外部内容类型后创建外部列表是一项非常简单的任务,有如下4种方式进行:

    • 可使用 Microsoft SharePoint Designer 2010
    • 浏览器来完成
    • VS2010的列表实例
    • 采用代码创建

     

    1、可使用 Microsoft SharePoint Designer 2010

    1. 启动 Microsoft SharePoint Designer,然后打开包含外部内容类型的 SDK 示例 SharePoint 网站。

    2. 单击左导航栏上的“外部内容类型”。这将显示在该网站的服务应用程序的 Business Data Connectivity (BDC) Service 元数据存储中定义的外部内容类型。选择“客户”外部内容类型作为外部列表的数据源。

    3. 若要创建外部列表,请单击“创建列表和表单”按钮(如下图中所示)以打开“为客户创建列表和表单”对话框。

      创建列表和表单按钮

    4. 输入 NWCustomers List 作为新外部列表的名称。默认情况下,BCS 为外部列表中的项的“查看”、“新建”、“编辑”和“删除”页创建常规 SharePoint 表单。不过,这些表单上的自定义功能有限。如果要在表单上执行丰富的自定义设置,可以将表单升迁为 InfoPath 表单,这只意味着常规 SharePoint 表单替换为 InfoPath 表单。然后,可以在 Microsoft InfoPath 中编辑这些表单。若要在创建列表时也创建 InfoPath 表单,请选中“创建 InfoPath 表单”复选框。然后单击“确定”。

      创建新外部列表

    SharePoint Designer 生成了外部列表。现在,您可以导航到 SharePoint 网站中的新列表并查看和编辑列表中的项。还可以使列表在 Microsoft Outlook 和 SharePoint Workspace 中脱机。下图显示了新创建的外部列表。

    用于客户的外部列表

    2、浏览器来完成

    1. 在左侧的“网站操作”菜单中,单击“查看所有网站内容”。

    2. 单击“创建”按钮。然后,在“自定义列表”部分,单击“外部列表”。

    3. 在“新建”页上,为新外部列表键入名称(例如 Northwind Customers)和说明。

    4. “数据源配置”部分显示了一个文本框和一个外部内容类型选取器。如果您知道外部内容类型的名称,则可以在文本框中输入它,也可以使用选取器从列表中选择外部内容类型。在本演练中,单击如下图中所示的选取器按钮。“外部内容类型选取器”对话框列出了该网站的服务应用程序的 Business Data Connectivity (BDC) Service 元数据存储中定义的所有外部内容类型。使用选取器,可以发现和选择要用作此列表的数据源的外部内容类型。在该示例中,选择“客户”,然后单击“确定”。最后单击“创建”。

      外部内容类型选取器

    这将创建外部列表。现在,您可以导航到 SharePoint 网站中的新列表并查看和编辑列表中的项。还可以使列表在 Microsoft Outlook 和 SharePoint Workspace 中脱机。下图显示了新外部列表。

    用于客户的外部列表

    3、采用VS2010的列表实例

    <?xml version="1.0" encoding="utf-8"?>
    
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    
      <ListInstance Title="CustomersListInstance"
    
                    OnQuickLaunch="TRUE"
    
                    TemplateType="600"
    
                    FeatureId="00bfea71-de22-43b2-a848-c05709900100"
    
                    Url="Lists/CustomersListInstance"
    
                    Description="External Customers List">
    
        <DataSource>
    
          <Property Name="LobSystemInstance" Value="Demo Customers" />
    
          <Property Name="EntityNamespace" Value="http://intranet" />
    
          <Property Name="Entity" Value="Demo Customers" />
    
          <Property Name="SpecificFinder" Value="CustomerRead Item" />
    
        </DataSource>
    
      </ListInstance>
    
    </Elements>
    
    Things to note:
    
    1) TemplateType – The external list template type Id is 600
    
    2) DataSource – Same as how we used the SPListDataSource.BDCProperties when creating an external list using object model
    

    4、采用代码创建(先用BCS工具创建一个BDC模型)

    Using the SPWeb.Lists.Add method we can create an 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);
    
        }
    
    }
    
    Using the SPListDataSource.BDCProperties, we can set the properties of the external system.
    
  • 相关阅读:
    Hive表中四种不同数据导出方式以及如何自定义导出列分隔符
    build doris 0.11.5 on centos 7/ubuntu
    centos7 gcc升级
    linux-nohup后台运行
    sqoop import mysql to hive table:GC overhead limit exceeded
    Hive开启mapjoin优化、并行执行、动态分区
    How to Plan and Configure YARN and MapReduce 2 in HDP 2.0
    Android 8 AudioPolicy 初始化
    Android 8 声音调整过程
    qcom wlan kernel 解读 WCNSS_qcom_cfg.ini 文件
  • 原文地址:https://www.cnblogs.com/love007/p/3139102.html
Copyright © 2011-2022 走看看