在SharePoint调查中创建问题时出错 [英] Error in creating question in SharePoint survey

查看:100
本文介绍了在SharePoint调查中创建问题时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天.我有一个错误来自服务器的意外响应.响应的状态码为"404".响应的状态文本为".在调查"中创建问题时.

Good day. I have an error "Unexpected response from server. The status code of response is '404'. The status text of response is ''." When creating questions in Survey.

感谢和问候,

Marver

推荐答案

嗨Marver,

Hi Marver,

以下代码供您参考:

<script type="text/javascript">
function processQuestion(){
	var clientContext;
	var oWebsite;
	var oList;
	var fieldCollection;
	
	var stringField = "<Field Type='Choice' DisplayName='Which search engine is the best' Format='RadioButtons' > <CHOICES> <CHOICE>Gloogle</CHOICE> <CHOICE>Bing</CHOICE> <CHOICE>others</CHOICE> </CHOICES> </Field>";
	
	clientContext = new SP.ClientContext.get_current();
    oWebsite = clientContext.get_web();
	oList = oWebsite.get_lists().getByTitle("SURVEY 0001");
	fieldCollection = oList.get_fields();
	
	//Add the fields
	fieldCollection.addFieldAsXml(stringField,false, SP.AddFieldOptions.addToDefaultContentType);
	clientContext.load(fieldCollection);
	clientContext.executeQueryAsync(onSuccess, onFailure);
}
function onSuccess() {
	alert('Add succeeded.');
}
function onFailure(sender, args) {
	alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
<input type="button" value="Add Question" onclick="processQuestion()"/>

如果仍然无法使用,请检查网站的网址和列表名称,确保它们正确无误.

If it still not work, please check the site url and list name, make sure they are right.

最好的问候,

丹尼斯


这篇关于在SharePoint调查中创建问题时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆