Office365 App开发之供应商托管Provider-hosted

Office 365的App开发提供其中一种开发方式是Provider-hosted,即web运行环境不在SharePoint主机上,而是自己另外搭建的web服务器,自己搭建的服务器可以是asp.net, jsp, php等,然后通过CSOM(Client side object model)访问SharePoint内容。

下面的例子就是这样的结构,先来看看效果,网站托管在本地的服务器,所以看到的是localhost,然后直接访问Office 365网站上的内容。

image

Configure the sample(配置例子代码)

To configure the hello world remote app using CSOM sample, update the SiteUrl property of the solution with the URL of the home page of your SharePoint 2013 site.(只需要设置SiteUrl为你在Office365的开发人员网站,不知道的可以参考 如何在Office365上创建APP应用

Build the sample(编译例子)

Press the F5 key to build and deploy the app.(按F5,VS2013会上传app到你的office365网站进行部署,然后运行localhost网站)

Run and test the sample(运行和测试例子)

  1. Choose Trust It on the consent page to grant permissions to the app.(部署的时候要点击“信任)
  2. Choose Populate Data to see some basic information about the parent web.(在页面点击”Populate Data“这个链接即可以看到读取的数据)

Provider-hosted代码下载

发表评论