sharepoint services
I have got solution for authentication to share point web service I have use
fedAuthCookie andrtfaCookie 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.
}
}
fedAuthCookieandrtFaCookieare 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 ...
随机推荐
- react 项目实战(三)表单验证
我们需要记录每一个字段当前的有效状态,有效时隐藏错误信息,无效时显示错误信息. 而这个有效/无效,可以在表单值改变的时候进行判断. 我们对/src/pages/UserAdd.js进行修改: 首先修改 ...
- hdu4057 Rescue the Rabbit(AC自己主动机+DP)
Rescue the Rabbit Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- sharepoint 訪问缩略图
Sharepoint缩略图 简单介绍 Sharepoint2010中有专门的图片库,当你新建图片库后,向图片上传一部分图片.当你浏览这个库时显示一排排小图片.当点击一个图片时进入显示的是大图.不要简单 ...
- 用R进行微博分析的初步尝试
新浪微博如火如荼,基于微博的各种应用也层出不穷. 有一种共识似乎是:微博数据蕴含着丰富的信息,加以适当的挖掘.可以实现众多商业应用.恰好社会网络分析也是我之前有所了解并持续学习的一个领域,因此我做了微 ...
- VC++ 模拟"CLICK事件"关闭指定窗体
今天改动一个工具时遇到一个有意思的问题,打开某个窗体时弹出一些不相关的窗体.须要用户自己去手动点击后才干继续.保证不了自己主动处理,如今解说决方案记录一下,例如以下 主要使用windows提供的Fin ...
- MPEG2、MPEG4、H264的差异
iso(国际标准化组织) MPEG系列 ITU-T(国际电联)h.系列 H.264:iso与ITU联合制定,数据压缩比超牛! MPEG-2简介 MPEG-2制定于1994年,设计目标是高级工业标准的图 ...
- Java 高级数据结构 —— Properties
1. Properties Properties 是 Java 的内置实现: public class Properties extends Hashtable<Object,Object> ...
- STM32:片上Flash 操作
之前IAP时候记录过一些,今天对特定地方写又加深了印象,写与擦除都需要先unclock //读取指定地址的半字(16位数据) //faddr:读地址(此地址必须为2的倍数!!) //返回值:对应数据. ...
- emma中文显示乱码问题解决
在Linux中如果使用mysql的图形客户端,个人感觉Emma还不错.但是emma默认用apt-get 安装的话,emma是不支持中文的,这个需要自己修改一下了配置文件,或者直接修改emma程序源文件 ...
- [App Store Connect帮助]六、测试 Beta 版本(3.2)管理测试员:邀请外部测试员
在您上传至少一个构建版本之后,您可以邀请外部测试员(您组织之外的人员)使用“TestFlight Beta 版测试”来测试您的 App.为了使您的构建版本可用于外部测试,请创建一个群组.添加构建版本, ...