1. CAML的结构。

<View Type="HTML" Name="Summary">

<ViewBody ExpandXML="TRUE">

<![CDATA[ <p><SPAN class=DocTitle><ows:Field Name="Title"/></SPAN>

(<ows:Field Name="Author"/>, <ows:Field Name="Modified"/>)

<ows:Limit><Field Name="Body"/></ows:Limit>

</p> ]]>

</ViewBody>

<Query>

<Where>

<Geq>

<FieldRef Name="Expires"/>

<Value Type="DateTime">

<Today/>

</Value>

</Geq>

</Where>

<OrderBy>

<FieldRef Name="Modified"/>

</OrderBy>

</Query>

<ViewFields>

<FieldRef Name="Summary"/>

<FieldRef Name="Author"/>

<FieldRef Name="Modified"/>

<FieldRef Name="Body"/>

</ViewFields>

</View>

 

可以在这个页面查看更详细的内容:

https://msdn.microsoft.com/en-us/library/office/ms438338.aspx

在这个页面上可以通过点击Parent Elements和Child Elements查看它可以包含的子元素和父元素。

 

  1. 如何通过CAML查询一个View里面的数据。

服务器端的API支持输入View的ID:

https://msdn.microsoft.com/en-us/library/ms434064(v=office.15).aspx

 

客户端的API则不支持:

https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.list.getitems.aspx

需要用如下的方法进行查询:

Public
ListItemCollection
GetSPItems(listName, viewName){

 

ClientContext context = new
ClientContext("http://SiteUrl");

 

List list1 = context.Web.Lists.GetByTitle(listName);

 

View view = list1.Views.GetByTitle(viewName);

clientContext.Load(view);

clientContext.ExecuteQuery();

CamlQuery query = new
CamlQuery();

camlQuery.ViewXml = view.ViewQuery;

ListItemCollection items = announcementsList.GetItems(query);

 

context.Load(items);

context.ExecuteQuery();

retun items;

 

}

 

//Example of usage:

 

ListItemCollection listItems = GetSPItems("Tasks", "My Tasks");

 

 

 

SharePoint CAML Query小结的更多相关文章

  1. SharePoint Caml Query 使用

    需要注意的是: 再使用ListQueryWebPart部件时,默认查看的list列表会出现乱码的情况,需要开启服务器呈现模式,如图: 特此记录一下

  2. CAML query for Group by count and data

    CAML query for Group by count and data Company Category Product Name Microsoft Developer Visual Stud ...

  3. Overcoming the List View Threshold in SharePoint CAML queries

    From: https://www.codeproject.com/articles/1076854/overcoming-the-list-view-threshold-in-sharepoint- ...

  4. 【转】SharePoint camel query查询 event 或者Calendar 日历列表的时候,怎么查询所有的重复发生的事件

    When you query a SharePoint calendar your results will contain: All non-recurring events The first e ...

  5. SHAREPOINT - CAML列表查询

    首先要了解的是CAML(Collaboration Application Markup Language)不仅仅是用在对列表.文档库的查询,字段的定义,站点定义等处处使用的都是CAML. 简单的提一 ...

  6. SharePoint CAML In Action——Part I

    在SharePoint中,我们经常要对List进行操作,比如要从List中取出相应的ListItem,利用CAML是个好办法.在没了解CAML之前,我是这样取数据的: MyList.Items.Cas ...

  7. SharePoint - CAML

    1. CAML是顺序操作,如果要实现类似 “A or B or C or D” 的结果,最好写成 “(((A or B) or C) or D)”的形式,但写成 “((A or B) or (C or ...

  8. SharePoint CAML In Action——Part II

    在SharePoint中,相对于Linq to SharePoint而言,CAML是轻量化的.当然缺点也是显而易见的,"Hard Code"有时会让你抓狂.在实际场景中,经常会根据 ...

  9. [总结]SHAREPOINT - CAML列表查询(上)

    首先要了解的是CAML(Collaboration Application Markup Language)不仅仅是用在对列表.文档库的查询,字段的定义,站点定义等处处使用的都是CAML. 简单的提一 ...

随机推荐

  1. android流量统计

    研究过一段时间的android流量统计发个自己的总结帖 1 android有一个TrafficStats类可以直接获取 总接受流量TrafficStats.getTotalRxBytes(), 总发送 ...

  2. SWD Registers

  3. Processing an OS Descriptor request -- Remote Desktop Protocol

    Special processing on the client is needed when processing TS_URB_OS_FEATURE_DESCRIPTOR_REQUEST. The ...

  4. 如何在socket编程的Tcp连接中实现心跳协议

    from http://blog.csdn.net/nyist327/article/details/39586203 心跳包的发送,通常有两种技术方法1:应用层自己实现的心跳包 由应用程序自己发送心 ...

  5. Windows Phone本地数据库(SQLCE):8、DataContext(翻译)

    这是“windows phone mango本地数据库(sqlce)”系列短片文章的第八篇. 为了让你开始在Windows Phone Mango中使用数据库,这一系列短片文章将覆盖所有你需要知道的知 ...

  6. 选股:“均线是水,K线是舟,量是马达!”的选美理念!

    选股:“均线是水,K线是舟,量是马达!”的选美理念! 很多庄家就是故意做数据,让某只股票的数据非常符合“理论”,引诱“技术派”股民

  7. Java 反射机制(包括组成、结构、示例说明等内容)

    第1部分 Java 反射机制介绍 Java 反射机制.通俗来讲呢,就是在运行状态中,我们可以根据“类的部分已经的信息”来还原“类的全部的信息”.这里“类的部分已经的信息”,可以是“类名”或“类的对象” ...

  8. Xcode工程文件打不开:cannot be opened because the project file cannot be parsed

    svn更新代码后,打开xcode工程文件,会出现  xxx..xcodeproj  cannot be opened because the project file cannot be parsed ...

  9. 架构:Introducing Expert Systems and Distributed Architecure

    原文地址:http://www.yourenterprisearchitect.com/2011/10/introducing-service-bus.html.   Expert Systems. ...

  10. Java锁的设计

    1.自旋锁 自旋锁是采用让当前线程不停地的在循环体内执行实现的,当循环的条件被其他线程改变时 才能进入临界区.如下 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public ...