2010 模板下载 罗斯文_在 SharePoint 中创建包含外部数据源数据的移动应用

在 SharePoint 中创建包含外部数据源数据的移动应用Create a mobile app in SharePoint that contains data from an external data source

09/25/2017

本文内容

了解如何通过使用 Business Connectivity Services 并连接到外部列表来在 SharePoint 中创建一个包含来自外部数据源的数据的简单移动应用程序。 SharePoint 使您能够使用 Business Connectivity Services 生成可以访问来自数据库、企业应用程序和 Web 2.0 服务的外部数据的移动应用程序。您还可以提供与外部数据的完整交互,包括从您的移动设备写回的功能。您可以通过创建连接到外部列表的应用程序来完成此操作,这些外部列表是 SharePoint 中基于外部内容类型且包含来自外部系统的数据的特殊类型的列表。Visual Studio 2010 Express 中的新 Windows Phone SharePoint 列表模板使您能够快速且轻松地为连接到外部列表的 Windows Phone 创建应用程序。例如,您可以生成将 SharePoint 中的库存清单的产品目录带到销售人员的电话中的 Windows Phone 应用程序。本主题演示了如何通过连接到 SharePoint 中的外部列表来创建显示来自罗斯文示例数据库的外部数据的 Windows Phone 应用程序。请注意,在此示例中,使用自定义 OData 服务将外部列表连接到了罗斯文数据库;不过,可以直接连接到数据库,还可以使用外部列表连接到 Business Connectivity Services 支持的任何外部系统。使用 Visual Studio 中的新 SharePoint 列表模板,您可以创建可以访问 SharePoint 网站上的外部列表的移动应用程序。本文提供了分步过程,开始于上载外部 Business Data Connectivity (BDC) 服务 模型,结束于测试您的新移动应用程序。Learn how to create a simple mobile app in SharePoint that contains data from external data source by using Business Connectivity Services and connecting to an external list. SharePoint enables you to build mobile applications that can access external data from databases, enterprise applications, and Web 2.0 services using Business Connectivity Services. You can also provide complete interaction with the external data including write-back capabilities from your mobile device. You do this by creating apps that connect to external lists, which are a special type of lists in SharePoint that are based on external content types and contain data from an external system. The new Windows Phone SharePoint List template in Visual Studio 2010 Express enables you to quickly and easily create apps for the Windows Phone that connects to external lists. For example, you can build a Windows phone app that brings the product catalog for an inventory list in SharePoint to the phone for the sales people. This topic shows how to create a Windows Phone app that displays external data from the Northwind sample database by connecting to an external list in SharePoint. Notice that in this example, the external list connects to the Northwind database using a custom OData service; however, it's possible to connect to databases directly as well as any external system that is supported by Business Connectivity Services, using external lists. With the new SharePoint List template in Visual Studio, you can create a mobile app that can access an external list on a SharePoint site. This article provides a step-by-step procedure that begins with uploading an external Business Data Connectivity (BDC) service model and ends with testing your new mobile app.

重要说明: 若要开发 Windows Phone 8 版应用,必须使用 Visual Studio Express 2012,而不是 Visual Studio 2010 Express。Important: If you are developing an app for Windows Phone 8, you must use Visual Studio Express 2012 instead of Visual Studio 2010 Express. 除开发环境外,本文中的其他所有信息都适用于创建 Windows Phone 8 和 Windows Phone 7 版应用。Except for the development environment, all information in this article applies to creating apps for both Windows Phone 8 and Windows Phone 7.

创建包含外部数据的移动应用的先决条件Prerequisites for creating a mobile app that contains external data

含用来为罗斯文数据库上载 BDC 模型的管理权限和在其中创建外部列表的 SharePoint 站点的 SharePoint 安装A SharePoint installation with administrative privileges to upload the BDC model for the Northwind database and a SharePoint site where you create the external list

具有 Microsoft SharePoint SDK for Windows Phone 7.1 中的新 SharePoint 电话模板的 Microsoft Visual Studio ExpressMicrosoft Visual Studio Express with the new SharePoint phone templates from Microsoft SharePoint SDK for Windows Phone 7.1

exampleNorthwind_oData.bdmc 的 BDC 模型(可从 SharePoint:创建一个简单的基于外部列表的电话应用程序中下载)The BDC model for our exampleNorthwind_oData.bdmc (download from SharePoint: Create a simple external list-based phone app)

含用来为罗斯文数据库上载 BDC 模型的管理权限和在其中创建外部列表的 SharePoint 站点的 SharePoint 安装A SharePoint installation with administrative privileges to upload the BDC model for the Northwind database and a SharePoint site where you create the external list

步骤 1:上载 BDC 元数据模型Step 1: Upload a BDC metadata model

BDC 模型是 Business Connectivity Services 的核心。它是使用 实体(外部内容类型)和 方法等数据结构来提取有关外部系统的复杂详细信息的 XML 文件。当您使用 SharePoint Designer 创建外部内容类型时会自动生成它,并且对于 .NET 和 OData 源等一些数据源类型,您需要手动创建 BDC 模型或使用 Visual Studio 创建 BDC 模型。当您使用 SharePoint 管理中心将 BDC 模型上载到 BDC 元数据存储时,该模型中定义的外部内容类型可用于在 SharePoint 中创建外部列表,它们是显示来自基础外部系统的数据的列表。在此步骤中,您将使用 SharePoint 管理中心将罗斯文示例 BDC 模型上载到元数据存储。A BDC model is the core of Business Connectivity Services. It's an XML file that uses data structures such as Entity (external content type) and Method to abstract out complex details about the external system. It's auto-generated when you create an external content type using SharePoint Designer and for some data source types such .NET and OData sources, you need to create the BDC model manually or by using Visual Studio. When you upload a BDC model to the BDC metadata store using SharePoint Central Administration, the external content types defined in the model can be used to create external lists in SharePoint which are lists that display data from the underlying external system. In this step, you'll upload the Northwind sample BDC model to the Metadata Store using SharePoint Central Administration.

导航到"管理中心"。Navigate to Central Administration.

选择"应用程序管理",然后选择"管理服务应用程序"。Choose Application Management, and then choose Manage Service Applications.

在"服务应用程序页",选择" Business Data Connectivity Service"。On the Service Application page, choose Business Data Connectivity Service.

在 BDC 服务应用程序的功能区,选择"导入"。On the ribbon in the BDC Service application, choose Import.

在"导入 BDC 模型"页,选择 "Business Data Connectivity Service"。On the Import BDC Model page, choose Business Data Connectivity Service.

在 BDC 服务应用程序的功能区,选择“导入”****。On the ribbon in the BDC Service application, choose Import.

在"导入 BDC 模型"页,选择"浏览"。On the Import BDC Model page, choose Browse.

在"选择要上载的文件"对话框中,浏览 Northwind_oData.bdcm 文件,然后选择"打开"。In the Choose a File to upload dialog box, browse to the Northwind_oData.bdcm file, and then choose Open.

导入文件后,选择"确定"按钮。After the file is imported, choose the OK button.

步骤 2:授予权限Step 2: Grant permissions

接着,您需要设置 BDC 模型上的权限以指定谁能执行该模型中描述的方法。这是一个必须执行的步骤。建议您给需要它们的每个用户或用户组特定的权限,通过这种方式,凭据提供了需要用于执行所需任务的最少的特权。有关设置权限的详细信息,请参阅 Business Connectivity Service 安全概览 (SharePoint Server 2010) 中的 Business Connectivity Service 权限概览。在此步骤中,您给了自己执行罗斯文示例 BDC 模型中介绍的方法的权限。Next you need to set permissions on the BDC model to specify who can execute the methods described in the model. This is a required step. We recommend that you give specific permissions to each user or group that needs them, in such a way that the credentials provide the least privilege necessary to perform the needed tasks. For more information about setting permissions, see Business Connectivity Service permissions overview in Business Connectivity Services security overview (SharePoint Server 2010). In this step, you give permission to yourself to execute the methods described in the Northwind sample BDC model.

导航到"管理中心"。Navigate to Central Administration.

选择"应用程序管理",然后选择"管理服务应用程序"。Choose Application Management, and then choose Manage Service Applications.

在“服务应用程序页”,选择“ Business Data Connectivity Service”****。On the Service Application page, choose Business Data Connectivity Service.

在功能区,从"视图"组的下拉列表中选择"BDC 模型"。In the ribbon, choose BDC Models from the drop-down list in the View group.

在 BDC 模型的列表中,将光标悬停在 Northwind_oData.bdcm 上,然后选择"设置权限"(如图 1 所示)。In the list of BDC models, hover over Northwind_oData.bdcm and choose Set Permissions, as shown in Figure 1.

图 1. 选择 BDC 模型的权限Figure 1. Choosing permissions for BDC model

3ff6ae3ec11d25adce094eb041a7c919.png

在"设置对象权限"对话框中,选择"浏览"按钮。In the Set Object Permissions dialog box, choose the Browse button.

在"选择人和组"对话框中,搜索您的账户,然后选择"确定"按钮。In the Select People and Groups dialog box, search for your account and choose the OK button.

为"编辑"、"执行"、"在客户端中可选"和"设置权限"选择权限(如图 2 所示)。Select the permissions for Edit, Execute, Selectable In Clients, and Set Permissions, as shown in Figure 2.

图 2. 设置对象权限Figure 2. Setting object permissions

59dbf4b0982c0019174814819f2e4a07.png

选择"确定"按钮。Choose the OK button.

在功能区,从"视图"组的下拉列表中选择"外部内容类型"。In the ribbon, select External Content Types from the drop-down list in the View group.

在外部内容类型的列表中,将光标悬停在"客户"上,然后选择"设置权限"。In the list of external content types, hover over Customer, and then choose Set Permissions.

在"设置对象权限"对话框中,选择"浏览"按钮,并搜索您的账户。In the Set Object Permissions dialog box, choose the Browse button and search for your account.

在"设置对象权限"对话框,选择"添加"并为"编辑"、"执行"、"在客户端中可选"和"设置权限"选择权限In the Set Object Permissions dialog box, choose Add and select the permissions for Edit, Execute, Selectable In Clients, and Set Permissions.

确保选择了"宣传权限"。Ensure that the Propagate Permissions box is selected.

选择"确定"按钮。Choose the OK button.

步骤 3:创建外部列表Step 3: Create an external list

既然您已经上载了 BDC 模型并设置了权限,那么您便可以基于 BDC 模型中定义的外部内容类型创建外部列表。在此步骤中,您将基于在 步骤 1:上载 BDC 元数据模型中上载的罗斯文 BDC 模型中定义的"客户"外部内容类型创建一个外部列表。Now that you've uploaded the BDC model and set permissions, you can create an external list based on the external content type defined in the BDC model. In this step, you will create an external list based on the Customer external content type defined in the Northwind BDC model you uploaded in Step 1: Upload a BDC metadata model.

导航到需要新列表的 SharePoint 网站。Navigate to the SharePoint site where you want the new list.

在该网站的主页上,选择"更多"。On the home page of the site, choose More.

在应用程序页上,选择"添加应用程序"。On the Apps page, choose Add an App.

在"添加应用程序"页,将光标悬停在"外部列表"上,然后选择"添加它"。On the Add an App page, hover over External List and choose Add it.

在“添加外部列表”**** 对话框中,在“名称”**** 字段中输入“客户”等名称。In the Adding an External List dialog box, enter a name such asCustomers in the Name field.

在“外部内容类型”**** 框中,指定在第 1 步上传的外部数据源。In the External Content Type box, specify the external data source that you uploaded in step 1.

选择“确定”**** 按钮。Choose the OK button.

在应用程序页,选择"客户列表"以查看该列表。On the Apps page, choose Customers List to view the list.

步骤 4.使用 Windows Phone SharePoint 列表应用程序模板创建移动设备应用程序Step 4: Create a mobile app using the Windows Phone SharePoint List Application template

外部列表已准备好,现在,您可以创建连接到 步骤 3:创建外部列表中创建的外部列表的 Windows Phone 7,还可以显示罗斯文数据库中的"客户"数据。Your external list is ready and you can now create a Windows Phone 7 app that connects to the external list you created in Step 3: Create an external list and display Customer data from the Northwind database.

启动 Visual Studio 2010 Express.Start Visual Studio 2010 Express.

在菜单栏,选择"文件"和"新项目"。将打开"新项目"对话框。On the menu bar, choose File, New Project. The New Project dialog box opens.

在"新项目"对话框,选择"Visual C#"和"Windows Phone 的 Silverlight ",然后选择"Windows Phone SharePoint 列表应用程序"。In the New Project dialog box, choose Visual C#, choose Silverlight for Windows Phone, and then choose Windows Phone SharePoint List Application.

为该项目指定名称。在此示例中,我们使用"CustomerApp"(如图 3 所示)。Specify a name for the project. We use CustomerApp in this example, as shown in Figure 3.

图 3. 在 Visual Studio 中选择 Windows Phone SharePoint 列表应用程序Figure 3. Selecting the Windows Phone SharePoint List Application template in Visual Studio

bca0c92c68b51c613414d67a31930b65.png

选择"确定"按钮。Choose the OK button.

在"SharePoint Phone 应用程序向导"中,输入您在其中创建了外部列表的 SharePoint 网站的 URL。In the SharePoint Phone Application Wizard, enter the URL of the SharePoint site in which you created the external list.

选择"客户"列表,然后选择"下一个"。Choose the Customers list, and choose Next.

在"选择视图"屏幕上,选择"客户读取列表",然后选择"下一个"。On the Choose Views screen, select Customer Read List and choose Next.

在"选择操作"屏幕上,选择"显示",然后选择"下一个"。On the Choose Operations screen, choose Display, and then choose Next.

在"选择字段"屏幕上,选择您要使用或显示在移动应用程序中的字段,然后选择"下一个"。On the Choose Fields screen, select the fields you want to use or display in your mobile app, and then choose Next.

在"订单字段"屏幕上,再订购所需的字段,然后选择"完成"。On the Order Fields screen, reorder the fields if needed, and then choose Finish.

现在,您已成功地创建了连接到外部列表的应用程序。You've now successfully created the app that connects to the external list.

运行并测试应用程序Run and test your app

既然该应用程序已为运行做好准备,那么您便可以使用电话仿真程序测试它。Now that the app is ready to run, you can test it using phone emulator.

在 Visual Studio 中,选择"调试",然后选择"启动调试"或按 F5。In Visual Studio, choose Debug, and then choose Start Debugging, or press F5.

系统出现提示时,使用与您用于登录到 SharePoint 网站相同的用户名和密码登录。确保您具有管理员权限。When prompted, log in by using the same username and password that you used to log in to the SharePoint site. Ensure that you have admin rights.

在结果"客户"列表中滚动(如图 4 所示)。Scroll through the resulting Customers list, as shown in Figure 4.

图 4.显示 SharePoint 外部列表的移动设备应用程序Figure 4. Mobile app displaying SharePoint external list

91332bb84c6c167525ff5f646e0bd537.png

备注

在使用 SharePoint 列表模板向导为具有只读字段的外部列表创建移动应用程序时,该向导生成的代码不允许用户创建或编辑项目。When you use the SharePoint List Template wizard to create a mobile app for an external list that has read-only fields, the code that is generated by the wizard does not allow users to create or edit items.

另请参阅See also

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值