Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ECMAScript不适用于匿名用户_Javascript_Sharepoint - Fatal编程技术网

Javascript ECMAScript不适用于匿名用户

Javascript ECMAScript不适用于匿名用户,javascript,sharepoint,Javascript,Sharepoint,我有一个类似于下面的代码来获取SharePoint 2013门户项目中的当前网站 var clientContext; var website; SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady); function sharePointReady() { clientContext = SP.ClientContext.get_current(); website = clientContext.get_web();

我有一个类似于下面的代码来获取SharePoint 2013门户项目中的当前网站

var clientContext;
var website;
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
function sharePointReady() {
clientContext = SP.ClientContext.get_current();
website = clientContext.get_web();

clientContext.load(website);
clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);
}
function onRequestSucceeded() {
    alert('URL of the website: ' + website.get_url());
}
function onRequestFailed(sender, args) {
    alert('Error: ' + args.get_message());
}
当我登录到网站时,一切都很完美。但当我用匿名用户打开网站时,网址不可用。我错过什么了吗


感谢

在SharePoint 2013中引入了新的权限级别
远程接口权限
,特别防止匿名用户访问CSOM库

如何为匿名用户启用CSOM
  • 去中央管理局
  • 转到管理Web应用程序
  • 选择您的Web应用程序
  • 单击功能区中的身份验证提供程序
  • 单击区域“默认”
  • 取消选中“需要使用远程接口权限”
该复选框将CSOM的使用与“使用远程接口”权限分离。选中时,它仅仅意味着用户必须拥有允许访问SOAP、Web DAV和客户机对象模型的“使用远程接口”权限

工具书类

感谢您解决了我的问题,但我仍然在搜索服务的显示模板中获得了一些值。所以,我无法获取网站的url