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下新建UserList.js文件. 创建并导出UserList组件: import React from 'react'; cla ...
- 记录一次node中台转发表单上传文件到后台过程
首发掘金 记录一次node中台转发表单上传文件到后台过程 本篇跟掘金为同一个作者leung 公司几个项目都是三层架构模式即前台,中台(中间层),后台.前台微信端公众号使用vue框架,后台管理前端使 ...
- xode5.1.1设置IOS欢迎界面的方法
先准备3张不同尺寸的欢迎图.文件名称分别为: Default.png iPhone 320X480分辨率屏幕默认启动图片. Default@2x.png iPhone 640X960分辨率屏幕默认启 ...
- Eclipse离线安装Emmet插件
Eclipse离线安装Emmet插件 近期发现了一个写前端代码很好的一个东西,一个叫做Emmet的工具,这个工具使用仿CSS选择器的语法来生成代码,大大提高了HTML/CSS代码编写的速度,前身就是大 ...
- 使用Hibernate防止SQL注入的方法
之前写代码,往后台传入一个组织好的String类型的Hql或者Sql语句,去执行. 这样其实是很蠢的一种做法!!!! 举个栗子~~ 我们模仿一下用户登录的场景: 常见的做法是将前台获取到的用户名和密码 ...
- QQ空间说说 视频播放
http://182.254.8.83/vwecam.gtimg.com/1006_d81d60f3c83844a5ad6a184149d4ccbb.f0.mp4?sha=78A27CF4908AB5 ...
- regulator_get 调用过程【转】
本文转载自:http://blog.csdn.net/u012719256/article/details/52083961 Touch panel DTS 分析(MSM8994平台,Atmel 芯片 ...
- Java 过滤器、监听器、拦截器的区别
原文:http://www.360doc.com/content/10/0601/09/495229_30616324.shtml 1.过滤器 Servlet中的过滤器Filter是实现了ja ...
- luogu 1726 上白泽惠音
题目大意: 给一个有向图 求一个最大的强连通分量,输出这个强连通分量里的所有元素 若两个联通分量内点数相同 则输出字典序小的那个 思路: 直接tarjan 对每个连通分量,求一下最小点,然后判断字典序 ...
- 清北考前刷题day2下午好
#include<iostream> #include<cstdio> #include<cstring> #include<stack> #defin ...