sharepoint services
I have got solution for authentication to share point web service I have use
fedAuth
Cookie andrtfa
Cookie to pass credentialFisrt I have load the login page in webview and to load login page of sharepoint
When user done with login i will store those Cookie with following method
func verifyCookies()
{
var status = 0
var cookieArray:NSArray = storage.cookies!
for cookie in cookieArray
{
if cookie.name == "FedAuth"
{
fedAuthCookie = cookie as NSHTTPCookie
status++
continue;
}
else if cookie.name == "rtFa"
{
status++
rtFaCookie = cookie as NSHTTPCookie
}
}
if status == 2
{
self.webView.hidden = true
self.cookieFound(rtFaCookie,fedAuthCookie: fedAuthCookie) // method mention below.
}
}
fedAuthCookie
andrtFaCookie
are variable name which store that cookieAnd after that I have use those cookie to pass credential to my request.
Below is my request code
func cookieFound(rtFaCookie:NSHTTPCookie,fedAuthCookie:NSHTTPCookie)
{
var message:String = "<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body><GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'><listName>demo</listName><viewName></viewName><query></query><viewFields></viewFields><rowLimit></rowLimit><QueryOptions></QueryOptions><webID></webID></GetListItems></soap:Body></soap:Envelope>"
var messageLength = String(countElements(message))
var url = NSURL(string: "https://domain/_vti_bin/Lists.asmx")
var therequest = NSMutableURLRequest(URL: url!)
therequest.addValue(messageLength, forHTTPHeaderField: "Content-Length")
therequest.addValue("text/xml; charset=utf-8", forHTTPHeaderField: "Content-Type")
therequest.addValue("http://schemas.microsoft.com/sharepoint/soap/GetListItems", forHTTPHeaderField: "SOAPAction")
// Authentication is passed in request header
var cookieArray = NSArray(objects: rtFaCookie,fedAuthCookie)
var cookieHeaders = NSHTTPCookie.requestHeaderFieldsWithCookies(cookieArray)
var requestHeaders = NSDictionary(dictionary: cookieHeaders)
therequest.allHTTPHeaderFields = requestHeaders
therequest.HTTPMethod = "POST"
therequest.HTTPBody = message.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
var connection = NSURLConnection(request: therequest, delegate: self, startImmediately: true)
connection?.start()
}
I have called
verifyCookies()
method from below webView methods
func webViewDidStartLoad(webView: UIWebView) {
self.verifyCookies()
}
func webViewDidFinishLoad(webView: UIWebView) {
self.verifyCookies()
}
Hope it will help someone
sharepoint services的更多相关文章
- Error message when you try to modify or to delete an alternate access mapping in Windows SharePoint Services 3.0: "An update conflict has occurred, and you must re-try this action"
Article ID: 939308 - View products that this article applies to. Expand all | Collapse all Symptoms ...
- SharePoint Services 数据库表
转:http://dugan.bokee.com/630446.html 以下是Microsoft Windows SharePoint Services架构中数据库列表. Configuration ...
- Windows SharePoint Services 3.0编码开发工具和技巧(Part 1 of 2)
转:http://blog.csdn.net/mattwin/article/details/2074984 WSSv3 Technical Articles_Windows SharePoint S ...
- Windows SharePoint Services 默认母版页
转:http://msdn.microsoft.com/zh-cn/library/ms467402(v=office.12).aspx 最终用户可以自定义的 Windows SharePoint S ...
- Microsoft Windows Sharepoint Services V3.0 安装图示
本文以图示的方式,向读者展示Microsoft Windows SharePoint Services V3.0的安装过程. 在以下图示的安装过程中,使用了下面所列出的软件: Windows Serv ...
- 错误:当你使用id作为sharepoint的自定义页面的查询参数时,总会提示项目不存在!
No item exists at http://SERVER/SITE/mypage.aspx?ID=1. It may have been deleted or renamed by anothe ...
- Sharepoint学习笔记—习题系列--70-576习题解析 -(Q144-Q146)
Question 144 You are planning a feature upgrade for a SharePoint 2010 farm. The original feature wi ...
- Sharepoint学习笔记—习题系列--70-573习题解析 -(Q147-Q150)
Question 147You have a Web application named WebApp1.You have a Feature receiver named FeatureReceiv ...
- Sharepoint学习笔记—习题系列--70-573习题解析 -(Q142-Q143)
Question 142You have a Feature that contains an image named ImageV1.png.You plan to create a new ver ...
随机推荐
- IOS-Storyboard控制器切换之Modal(1)
Modal模式是指模态切换.新开的界面会挡住之前的界面,使之不能获取焦点. 创建一个singleView模板的程序,打开storyboard文件.拖动2个UIViewController到界面中.按住 ...
- 基于Office 365 无代码工作流分析-数据源的建立!
标准操作步骤 下面整个步骤我们是以嘉昊信息的招聘过程的整个流程为一个场景,整个的流程场景的步骤例如以下: 整个的过程,我们通过Infopath 进行对应的表单流转,然后利用Sharepoint ...
- sharepoint 訪问缩略图
Sharepoint缩略图 简单介绍 Sharepoint2010中有专门的图片库,当你新建图片库后,向图片上传一部分图片.当你浏览这个库时显示一排排小图片.当点击一个图片时进入显示的是大图.不要简单 ...
- 使用Node搭建reactSSR服务端渲染架构
如题:本文所讲架构主要用到技术栈有:Node, Express, React, Mobx, webpack4, ES6, ES7, axios, ejs, log4js, scss,echarts, ...
- java7新特性之Try-with-resources (TWR)
java7新特性之Try-with-resources (TWR) This change is easy to explain, but it has proved to have hidden s ...
- 后台进程管理工具---supervisor
supervisor是一个linux下的进程管理工具,有时须要开发一些后台服务类的程序.这类程序通常不能由于意外挂掉.所以最好能在出现意外挂掉的情况下可以重新启动,继续服务. 之前我一直採用创建dae ...
- Android ListView的item点击无响应的解决方法
假设listitem里面包含button或者checkbox等控件,默认情况下listitem会失去焦点,导致无法响应item的事件,最经常使用的解决的方法 是在listitem的布局文件里设置des ...
- Python爬虫开发【第1篇】【HTTP与HTTPS请求与响应】
一.HTTP.HTTPS介绍 HTTP协议(超文本传输协议):一种发布.接收HTML页面的方法 HTTPS协议:简单讲是HTTP安全版,在HTTP下加入SSL层 SSL(安全套接层),用于WEB的安全 ...
- HDU 5773The All-purpose Zero
The All-purpose Zero Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Oth ...
- CSU 1807: 最长上升子序列~ 分类讨论
1807: 最长上升子序列~ Time Limit: 5 Sec Memory Limit: 128 MBSubmit: 138 Solved: 17[Submit][Status][Web Bo ...