특정 SharePoint 사이트의 "Pages"목록에서 특정 항목을 검색하려고합니다. 내가 쿼리하는 FileLeafRef와 관련된 특정 항목 만 반환하는 쿼리를 원합니다. 필자는 SP CAML Query 도우미 도구를 사용하여 테스트 한 CAML 쿼리를 작성 했으므로 CAML 쿼리가 좋다고 생각합니다. 난 그냥 클라이언트 컨텍스트를 사용하여 항목을 쿼리하는 방법을 알아낼 수 없습니다. 여기에 기존 코드이다 : 나는 많은 ListItems 수집을 살펴 때,하는 executeQuery에 대한 호출 후FileLeafRef로 쿼리 할 때 sharepoint caml 쿼리가 작동하지 않습니다.
Dim FileLeafRef As String = "SomeArbitrarilyNamedThing.aspx"
Dim clientContext As New Microsoft.SharePoint.Client.ClientContext("http://myfqdn/newsandmedia/companynews")
Dim theList As Microsoft.SharePoint.Client.List = clientContext.Web.Lists.GetByTitle("Pages")
Dim camlQuery As New Microsoft.SharePoint.Client.CamlQuery()
camlQuery.ViewXml = String.Format("<Query><Where><Eq><FieldRef Name=""FileLeafRef"" /><Value Type=""Text"">{0}</Value></Eq></Where></Query>", FileLeafRef)
Console.WriteLine(camlQuery.ViewXml)
Dim listItems As Microsoft.SharePoint.Client.ListItemCollection = theList.GetItems(camlQuery)
clientContext.Load(theList)
clientContext.Load(listItems)
clientContext.ExecuteQuery()
, 내가를 쿼리있어 하나 개의 항목 이상을 가지고있다. (구체적으로는 15 개이지만 요청한 FileLeafRef가있는 항목이 하나만 있어야합니다.) 누구든지이 코드의 문제점을 파악하여 나를 도울 수 있습니까?
감사
편집 : 이후보기 태그로 camlQuery XML을 포장하는 경우, 그것이 내가 원하는 목록 항목을 반환 발견했습니다. 나는 이유를 모른다. 이 태그가이 컨텍스트에서 수행하는 작업을 누구나 설명 할 수 있고 쿼리가 처음에 15 개 결과를 반환하는 이유는 무엇입니까?