从Provider托管应用程序验证Azure上托管的SharePoint 2013

编程入门 行业动态 更新时间:2024-10-24 21:37:07
本文介绍了从Provider托管应用程序验证Azure上托管的SharePoint 2013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,

有没有办法通过提供商托管应用对Azure上托管的SharePoint 2013网站的用户进行身份验证?

Is there a way to authenticate users to a SharePoint 2013 site hosted on Azure from Provider hosted app?

谢谢,

Sowmya

推荐答案

嗨Sowmya,

Hi Sowmya,

对于SharePoint在线,我们可以执行以下操作。

For SharePoint online, we can do as below.

public ClientContext Auth(String username, String pwd,string siteURL) { ClientContext context = new ClientContext(siteURL); Web web = context.Web; SecureString passWord = new SecureString(); foreach (char c in pwd.ToCharArray()) passWord.AppendChar(c); context.Credentials = new SharePointOnlineCredentials(username, passWord); try { context.Load(web); context.ExecuteQuery(); Console.WriteLine("Olla! from " + web.Title + " site"); return context; } catch (Exception e) { Console.WriteLine("Something went wrong in Auth Module" + e); Console.ReadKey(); return null; } }

对于SharePoint 2013,我们可以执行以下操作。

For SharePoint 2013, wo can do as below.

public ClientContext Auth(String username, String pwd, string domain, string siteURL) { ClientContext context = new ClientContext(siteURL); Web web = context.Web; context.Credentials = new NetworkCredential(username, pwd, domain); try { context.Load(web); context.ExecuteQuery(); Console.WriteLine("Olla! from " + web.Title + " site"); return context; } catch (Exception e) { Console.WriteLine("Something went wrong in Auth Module" + e); Console.ReadKey(); return null; } }

祝你好运,

Lee Liu

更多推荐

从Provider托管应用程序验证Azure上托管的SharePoint 2013

本文发布于:2023-11-17 05:26:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608985.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   Provider   Azure   SharePoint

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!