目标:将sharepoint网站对接Office 365
最直接的API:How to: Add Office 365 APIs to a Visual Studio project
http://msdn.microsoft.com/en-us/library/office/dn605899(v=office.15).aspx ,但目前限定为win8 app或web application。不能用于service,因此放弃。
继续研究:Authentication with SharePoint Online and the Client Side Object Model http://blogs.msdn.com/b/cjohnson/archive/2011/05/03/authentication-with-sharepoint-online-and-the-client-side-object-model.aspx ,但这种方式需要打开一个页面验证身份后,读取cookie来操作。对于service,读取cookie存在权限问题,所以再次放弃。
继续研究:
SharePoint Online for Office 365 Developer Guide http://msdn.microsoft.com/zh-cn/library/hh147180.aspx
得到方案 the SharePoint 2013 REST Interface:
Understanding and Using the SharePoint 2013 REST Interface http://msdn.microsoft.com/en-us/magazine/dn198245.aspx
Tips and FAQ: OAuth and remote apps for SharePoint http://msdn.microsoft.com/en-us/library/fp179932.aspx
Guidelines for registering apps for SharePoint 2013 http://msdn.microsoft.com/en-us/library/jj687469%28v=office.15%29.aspx
the sample: SharePoint 2013: Perform basic data access operations by using REST in apps http://code.msdn.microsoft.com/SharePoint-2013-Perform-335d925b
create a App from our site()注册(在构建远程应用程序之前,您必须生成应用程序 ID、应用程序密钥等。生成并创建这些值)
https://microsoft.sharepoint.com/teams/******/_layouts/15/appregnew.aspx
授权(可以查找已注册应用程序的应用程序注册信息)
https://microsoft.sharepoint.com/teams/*******/_layouts/15/appinv.aspx
格式如下:
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="https://microsoft.sharepoint.com/teams/******" Right="FullControl"/>
</AppPermissionRequests>
从以下页面中检索应用程序主体的列表:
https://microsoft.sharepoint.com/teams/******/_layouts/15/appprincipals.aspx
Permission Request XML :
App authorization policy types in SharePoint 2013 http://msdn.microsoft.com/en-us/library/fp179892%28v=office.15%29.aspx and
App permissions in SharePoint 2013 http://msdn.microsoft.com/en-us/library/fp142383%28v=office.15%29.aspx
这里讲得挺详细:SharePoint 2013 中需要即时访问权限的应用程序的 OAuth 身份验证和授权流程(高级主题)http://msdn.microsoft.com/zh-cn/library/jj687470%28v=office.15%29.aspx