SharePoint在线SOAP调用错误 [英] SharePoint online SOAP call errors

查看:69
本文介绍了SharePoint在线SOAP调用错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi,

我正在使用Outlook宏来阅读来自SharePoint的数据。该代码到目前为止使用SP2010,SP2013,现在我们已迁移到SharePoint Online。

I am using a Outlook macro to read data from SharePoint. The code works till now using SP2010, SP2013 , now we migrated to SharePoint Online.

现在迁移后,我们面临着使用相同代码读取数据的问题。

After migrating now we are facing issue with same code to read data.

推荐答案

您好Koti,

Hi Koti,

对于SharePoint Online,需要使用SharePointOnlineCredentials类获取身份验证cookie然后添加到请求标头中:

For SharePoint Online, needs to use SharePointOnlineCredentials class to get authentication cookies and then add into request header:

        private static CookieContainer GetAuthCookies(Uri webUri, string userName, string password) 
        { 
            var securePassword = new SecureString(); 
            foreach (var c in password) { securePassword.AppendChar(c); } 
            var credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(userName, securePassword); 
            var authCookie = credentials.GetAuthenticationCookie(webUri); 
            var cookieContainer = new CookieContainer(); 
            cookieContainer.SetCookies(webUri, authCookie); 
            return cookieContainer; 
        } 

参考:

SOAP服务调用的SharePoint Online身份验证

谢谢

最好的问候


这篇关于SharePoint在线SOAP调用错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆