【发布时间】:2014-12-10 05:21:19
【问题描述】:
我的代码如下所示
try
{
string strUserName="abc";
string strPassword="123";
ClientContext context = new ClientContext(siteurl);
var credentials = new NetworkCredential(strUserName, strPassword,"Ext");
context.Credentials = credentials;
// The SharePoint web at the URL.
Web web = context.Web;
// We want to retrieve the web's properties.
context.Load(web);
// Execute the query to the server.
context.ExecuteQuery();
// Now, the web's properties are available and we could display
// web properties, such as title.
System.Console.WriteLine("Web Title");
System.Console.WriteLine(web.Title);
}
catch (Exception ex)
{
}
报错“无法连接远程服务器”
【问题讨论】:
-
猜测您的用户名没有足够的权限访问该站点。您可以检查您的详细错误信息及其调用堆栈以获取线索
-
它有权限,当我从浏览器访问时,我可以使用这些凭据进行访问。从 c# 给出的错误“远程证书根据验证过程无效,无法为 ssl/tls 安全通道建立信任关系”
-
我的电脑上没有安装共享点。您已检查过您的共享点日志?此错误消息可能与您的客户端和共享点之间的证书验证有关
-
siteurl的值是多少?
标签: c# sharepoint csom