惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

SecWiki News
SecWiki News
H
Help Net Security
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence
Jina AI
Jina AI
L
LangChain Blog
K
Kaspersky official blog
I
Intezer
Martin Fowler
Martin Fowler
爱范儿
爱范儿
AWS News Blog
AWS News Blog
The Hacker News
The Hacker News
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
CXSECURITY Database RSS Feed - CXSecurity.com
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
U
Unit 42
N
News and Events Feed by Topic
A
Arctic Wolf
G
GRAHAM CLULEY
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 聂微东
F
Fortinet All Blogs
C
Cisco Blogs
美团技术团队
Vercel News
Vercel News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Hacker News: Front Page
T
Tailwind CSS Blog
I
InfoQ
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
博客园 - 司徒正美
P
Palo Alto Networks Blog
A
About on SuperTechFans
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
云风的 BLOG
云风的 BLOG
TaoSecurity Blog
TaoSecurity Blog
Google Online Security Blog
Google Online Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy & Cybersecurity Law Blog
H
Heimdal Security Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
O
OpenAI News
博客园 - Franky
Scott Helme
Scott Helme

博客园 - 生鱼片

Gitlab安装过程 SharePoint 2013即SharePoint 15的一些新特性 关于虚机克隆模板导致无法添加域用户的问题 http header Content-type SharePoint 2010 文档库中直接打开文档 使用SymbolResolver在Activity内访问宿主环境信息 增加一个Export to Spreadsheet的链接 WF4:自定义跟踪参考者 WF4:ETW跟踪参与者 WF4集合Collection相关活动用法 SharePoint 2010 BI(2):使用Visio Service SharePoint 2010 BI (1):Chart WebPart 微软WebMatrix介绍 使用Sharepoint 2007中的webservice操作列表 - 生鱼片 - 博客园 使用SharePoint Designer 2010 创建 外部内容类型 WF4:同步执行工作流 - 生鱼片 - 博客园 SharePoint 2010中托管元数据 SharePoint 2010中的客户端模型 SharePoint 2010中的Content Query WebPart
SharePoint中CAML使用的一些总结
生鱼片 · 2011-01-12 · via 博客园 - 生鱼片

协作应用程序标记语言 (CAML) 是一种基于 XML 的语言,用于在 Windows SharePoint Services 中定义在网站和列表中使用的字段和视图。CAML 还用于在网站设置过程中定义 Windows SharePoint Services 数据库中的表。也可以对列表进行更新,在使用SharePoint Web Service的时候十分重要。详细的规范请参考http://msdn.microsoft.com/zh-cn/library/ms462365.aspx,本文列出一些常用的和重要的信息。

1. 一些属性 

RowLimit:<RowLimit>10</RowLimit> 查询结果的返回行限制 

ViewFields:<ViewFields> <FieldRef Name='Title'/> <FieldRef Name='Name'/></ViewFields>查询结果要显示的字段 

2. 查询条件 

query.Query = "<Where><Eq><FieldRef Name='Status'/>" + "<Value Type='Text'>Completed</Value></Eq></Where>";

2.1.比较操作符如下:

Comparison Operators

General Meaning

Eq

=

Gt

>

Lt

<

Geq

>=

Leq

<=

Neq

<>

Contains

Like

IsNull

Null

IsNotNull

NotNull

BeginsWith

Beginning with word

DateRangesOverlap

compare the dates in a recurring event with a specified DateTime value, to determine whether they overlap

2.2.Or

.<Where> <Or> <Geq><FieldRef Name='Field1'/> <Value Type='Number'>1500</Value> </Geq> <Leq> <FieldRef Name='Field2'/><Value Type='Number'>500</Value> </Leq> </Or> </Where>

2.3.And

<Where> <And> <BeginsWith> <FieldRef Name="Conference"/> <Value Type="Note">Morning</Value> </BeginsWith> <Contains> <FieldRef Name="Conference" /> <Value Type="Note">discussion session</Value> </Contains> </And></Where>

2.4.Orderby

<OrderBy>

<FieldRef Name="Modified" Ascending="FALSE"></FieldRef>

</OrderBy>

2.5.GroupBy

<GroupBy>

<FieldRef Name="Modified"/>

</GroupBy>

3.转义

Original

Replacement

"

\"

\

\\

+

\u002b

>

\u003e

<

\u003c

'

\u0027

例:

<FieldRef Name=\"Checkbox\"></FieldRef> <Value Type=\"bit\">1</Value>

4.Batch

内嵌于 HTTP 协议中,Batch 元素必须至少包含一个 Method 元素。Batch 元素允许客户端应用程序一次性向服务器传送多个命令。

4.1.格式

<Batch

OnError = "Return" | "Continue"

ListVersion = ""

Version = ""

ViewName = "">

<Method>

...

</Method>

...

</Batch>

属性

说明

ListVersion

可选属性,类型为 Integer。指定列表的版本号。

OnError

可选。以下是可能的值:

· Return — 在遇到第一个错误之后,停止执行任何方法。此值为默认值。

· Continue — 在遇到错误后,继续执行后续方法。

Version

可选属性,类型为 String。指定正在服务器上运行的 Windows SharePoint Services 的版本号。版本号包含四个整数,格式为 N.N.N.NNNN,它们表示产品的主版本、次版本、阶段版本和增量版本。

ViewName

可选属性,类型为 Guid。指定视图的 GUID。

4.2.Method:在批处理中用于指定 Batch 元素中的命令。 

Method 元素是 Batch 元素所必需的

<Method ID="Text"

Cmd = "Text"

ID = "Text">

</Method>

属性

说明

Cmd

可选属性,类型为 Text。在 Web 服务中使用,指定相关命令发布到服务器以进行列表项更新。可能的值包括:

· Delete — 删除指定项目。

· New — 创建指定项目。

· Update — 修改指定项目。

ID

必需属性,类型为 Text。自由形式标识字符串,它实际并非由服务器使用,而是返回到客户端。

4.3. SetList:指定当前正在使用的列表。

<SetList

Name = "Text"

PreserveContext = "TRUE" | "FALSE"

Scope = "Request">

</SetList>

属性

说明

Name

必需属性,类型为 Text。指定该列表的名称。

PreserveContext

可选属性,类型为 Boolean。如果为 FALSE,则实现 SetList 元素将返回数据库查询,该查询是获取显示单个列表项的表单中数据所必需的。当视图和表单位于同一页面中时,此功能非常有用。默认值为 TRUE。

Scope

当设置为 Request 时,此属性使整个列表可用于该页面。

4.4. SetVar:允许在本地将页呈现到当前 XML 级别或将页全局呈现到页的上下文中设置变量。

<SetVar

ID = "Text"

Name = "Text"

Scope = "Request"

Value = "Text">

</SetVar>

属性

说明

ID

可选属性,类型为 Text。提供变量的 ID。

Name

必需属性,类型为 Text。指定变量的名称。

Scope

如果设置为 Request,则变量是全局变量。

Value

可选属性,类型为 Text。当这是一个空元素时,可用于为变量指定值。

在下面的示例中,第一个 GetVar 元素返回“Value_2”,第二个 GetVar 元素返回“Value_1”,因为包含“Value_2”的 SetVar 元素仅适用于“Sample”元素的子级。“Value_2”在“Sample”结束标记之后超出范围。

XML

<SetVar Name="myVar">Value_1</SetVar>

<Sample>

<SetVar Name="myVar">Value_2</SetVar>

<GetVar Name="myVar"/>

</Sample>

<GetVar Name="myVar"/>

4.5.例子

batchElement.InnerXml = "<Method ID='1' Cmd='Update'>" +

"<Field Name='ID'>6</Field>" +

"<Field Name='Title'>Modified sixth item</Field></Method>" +

"<Method ID='2' Cmd='Update'><Field Name='ID'>7</Field>" +

"<Field Name='Title'>Modified seventh item</Field></Method>" +

"<Method ID='3' Cmd='Delete'><Field Name='ID'>5</Field>" +

"</Method><Method ID='4' Cmd='New'>" +

"<Field Name='Title'>Added item</Field></Method>";

5.WSS中的各种字段类型与.NET中对应的数据类型的对照关系

Name

Format

Attachments

System.Boolean

Boolean

System.Boolean

Calculated

N/A

Choice

System.String

Computed

N/A

Counter

System.Int32

CrossProjectLink

System.Boolean

Currency

System.Double

DateTime

System.DateTime

GridChoice

System.String

Guid

System.Guid

Integer

System.Int32

Lookup

System.String

MaxItems

System.Int32

ModStat

System.Int32

MultiChoice

System.String

Note

System.String

Number

System.Double

Recurrence

System.Boolean

Text

System.String

Threading

System.String

URL

System.String, System.String

User

System.String