项目没熟悉,就让我改一个需求。也不熟sharepoint
现在有一个查询语句是这样的:
query = "<Query>"+ camlBuilder.Where().DateField("Valid_x0020_Thru").GreaterThanOrEqualTo(date)
.And()
.ChoiceField("Status").EqualTo("Completed & Published")
.And()
.ChoiceField("Customer").EqualTo("Employee")
.And()
.NoteField("FAQ_x0020__x002d__x0020_Question").Contains(answerText)
.Or()
.NoteField("FAQ_x0020__x2013__x0020_Answer").Contains(answerText)
.ToString() +"</Query>";
就是传过来一个answerText,我现在要想传过来的是一个数组,就是FAQ_x0020__x002d__x0020_Question这个字段既包括answerText1,又包括answerText2. 3,4,等等,我就不知道怎么拼这个了
瞎改吧,
var queryObj = camlBuilder.Where().DateField("Valid_x0020_Thru").GreaterThanOrEqualTo(date)
.And()
.ChoiceField("Status").EqualTo("Completed & Published")
.And()
.ChoiceField("Customer").EqualTo("Employee");
for (var i = 1; i <= answerText.length; i++) {
queryObj
.And()
.NoteField("FAQ_x0020__x002d__x0020_Question").Contains(answerText[i])
.Or()
.NoteField("FAQ_x0020__x2013__x0020_Answer").Contains(answerText[i])
}
query = "<Query>" + queryObj.toString + "</Query>";
这样也不行。。
谢谢了
------解决思路----------------------
看样子
.Or()
.NoteField("FAQ_x0020__x2013__x0020_Answer").Contains(answerText)
.Or()
.NoteField("FAQ_x0020__x2013__x0020_Answer").Contains(answerText2)
.Or()
.NoteField("FAQ_x0020__x2013__x0020_Answer").Contains(answerText3)
应该就行了。。你的循环好像写的不太对