[英]Getting error while connecting to Office 365 sharepoint
I am trying to connect to office 365 sharepoint using clientid and clientsecret in OfficeDevPnP.Core.AuthenticationManager() method but i am getting below error我正在尝试使用 OfficeDevPnP.Core.AuthenticationManager() 方法中的 clientid 和 clientsecret 连接到 office 365 sharepoint 但我遇到以下错误
I am using below code to connect to sharepoint:我正在使用以下代码连接到 sharepoint:
var authManager = new OfficeDevPnP.Core.AuthenticationManager();
string appId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
string appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
string siteURL = "https://xxxxxxxx.sharepoint.com/";
string siteName = "";
using (ClientContext context = authManager.GetAppOnlyAuthenticatedContext(siteURL, appId, appSecret))
{
Site objSite = context.Site;
context.Load(objSite);
context.ExecuteQuery();
siteName = objSite.Url.ToString();
Console.WriteLine("Site Url:" + objSite.Url);
}
What am I doing wrong?我究竟做错了什么? Currently my site is localhost so have setup below details目前我的网站是本地主机,所以在下面设置了详细信息
Your company must have a Proxy, it will be necessary to define the following information in your Web Config:您的公司必须有一个代理,有必要在您的 Web 配置中定义以下信息:
<system.net>
<defaultProxy enabled="true">
<proxy proxyaddress="http://urlyourproxy:port" bypassonlocal="True"/>
</defaultProxy>
</system.net>
Right after inserting this works fine!插入后立即工作正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.