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 ...
随机推荐
- jquery 联动 年月日
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>JQuery实例 - 生成年 ...
- Django打造大型企业官网(三)
四.前端首页 4.1.导航条实现 (1)templates/new/index.html <!DOCTYPE html> <html lang="en"> ...
- linux c 获取当前执行进程总数
获取当前执行进程总数的命令为: ps auxw | wc -l 获取当前执行进程总数的源代码例如以下: #include <stdio.h> #include <stdlib.h&g ...
- 抢占式内核与非抢占式内核中的自旋锁(spinlock)的差别
一.概括 (1)自旋锁适用于SMP系统,UP系统用spinlock是作死. (2)保护模式下禁止内核抢占的方法:1.运行终端服务例程时2.运行软中断和tasklet时3.设置本地CPU计数器preem ...
- C++之new和malloc差别
在C++程序猿面试中.非常easy被问到new 和 malloc的差别.偶尔在quora上逛.看到Robert Love的总结.才发现自己仅仅知道里面的一两项就沾沾自喜,从来没有像这位大牛一 ...
- 深入浅出Hibernate(二)多对一关系映射
学习Hibernate是为了更方便的操作数据库,在数据库中的关系模型中存在多对一的关系,比方下图所看到的的员工和部门之间的关系,那么这样的关系在Hibernate中怎样映射呢?让我用一个小Demo来具 ...
- mouse_event function
https://msdn.microsoft.com/en-us/library/windows/desktop/ms646260(v=vs.85).aspx
- linux shell 实例1
UI项目删除“UIL”文件中的无用字串: 脚本需要制定UIL文件目录位置&无用字串的txt文件,如删除海尔目录下的无用字串: ./delete_uil_string.sh ./haier/UI ...
- 【转】整套完整安全的API接口解决方案
原文地址:http://www.cnblogs.com/hubro/p/6248353.html 在各种手机APP泛滥的现在,背后都有同样泛滥的API接口在支撑,其中鱼龙混杂,直接裸奔的WEB API ...
- AngularJS 指令(意义)
angular.module('modulename') .directive('myDirective', function(){ return { restrict: 'EA', //E表示ele ...