Windows Phone 8.1应用程序的SharePoint Online身份验证中的问题

时间:2014-10-03 12:23:28

标签: authentication sharepoint windows-phone-8.1

我正在使用SharePoint Online Client组件(如下面的链接)来验证Windows Phone 8.1应用程序中的SharePoint http://www.microsoft.com/en-us/download/details.aspx?id=42038

当我尝试在Windows Phone模拟器上运行我的Windows Phone 8.1应用程序时,身份验证就像一个魅力。但是当我将相同的应用程序部署到Windows Phone 8.1设备并尝试对SharePoint进行身份验证时,我得到以下异常:

“身份客户端运行时库(IDCRL)在与伙伴STS交谈时遇到错误。”。

注意:我使用以下三个DLL - Microsoft.SharePoint.Client.Portable.dll
- Microsoft.SharePoint.Client.Runtime.Portable.dll
- Microsoft.SharePoint.Client.Runtime.WindowsPhone.dll

我不能使用以下两个DLL,因为没有选项可以在Window Phone 8.1应用程序中使用SecureString类,SharePointOnlineCredentials类构造函数将其作为参数之一使用。它无论如何都不存在于System.Security命名空间中 - Microsoft.SharePoint.Client.dll
- Microsoft.SharePoint.Client.Runtime.dll

请给我一些建议。 :-(

代码如下:

public static void setContext(string SharePointWebUrl)
    {            
        using (Microsoft.SharePoint.Client.ClientContext _context = new ClientContext(SharePointWebUrl))
        {
            try
            {
                var onlineCredentials = new SharePointOnlineCredentials(UserName, Password);

                _context.Credentials = onlineCredentials;
                _context.AuthenticationMode = ClientAuthenticationMode.Default;                    

                _web = _context.Web;
                _site = _context.Site;
                _context.Load(_web);
                _context.Load(_site);
                _context.ExecuteQueryAsync();

                Utility.isAuthenticated = true;
            }
            catch(Exception ex1)
            {
                Utility.isAuthenticated = false;   
            }
        }
    }

0 个答案:

没有答案
相关问题