日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

对CAML查询语句的几点小记

發布時間:2024/4/13 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 对CAML查询语句的几点小记 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?CAML(Collaborative Application Markup Language)——協作應用程序標記語言,在調用WSS提供的諸多Web Service時進行數據查詢的一組XML規范,通過這種規范組織查詢語句進行數據的檢索。我在這里不想再具體介紹CAML的使用規范和具體語法了,讀者在MSDN或者園子里的其它文章中都可以了解到。

http://msdn.microsoft.com/zh-cn/library/ms462365.aspx

http://www.cnblogs.com/shanqian/archive/2008/09/25/859513.html

??? 這里我想給出我在項目實際應用中所積累的有關使用CAML查詢語句時所解決的問題。

1. Sharepoint的List中允許創建Document和Folder兩種類型的數據,在查詢時如何查出非Folder類型的數據?

1?<Query>?
2???<Where>?
3??????<Neq>?
4????????<FieldRef?Name="ContentType"/>?
5????????<Value?Type="Text">Folder</Value>?
6??????</Neq>?
7???</Where>?
8?</Query>

??? 當服務器上安裝有WSS的多語言包時,根據不同的語言ContentType的值也會有不同的寫法,可以借助CAML工具或者在WSS查詢返回的報文中查看一下,確認ContentType的具體類型名稱。

2. 如何查詢List中Lookup類型的字段的值?

??? Loopup類型的字段在數據庫中相當于外鍵,數據格式如1;#title1;#2;#title2,查詢時可以按照下面的CAML。

1?<Query>??
2?<Where>??
3???<Eq>??
4????<FieldRef?Name="ProjectID"?/>??
5????<Value?Type="Lookup">My Test Project 1</Value>??
6???</Eq>??
7?</Where>??
8?</Query> ??????? Value中只需要填寫外鍵所對應的名稱,而不用填寫外鍵所對應的id。如果只知道id而不知道名稱則可以使用下面的CAML。 1?<Query>??
2?????<Where>??
3?????<Eq>??
4?????????<FieldRef?Name="ProjectID"?LookupId="TRUE"?/>??
5?????????<Value?Type="Text">3</Value>??
6?????</Eq>??
7?????</Where>??
8?</Query>

3.?Lists.GetListItems()方法中的參數。

??? 對于該方法中參數的詳解,讀者可以參考MSDN:

http://msdn.microsoft.com/zh-cn/library/websvclists.lists.getlistitems.aspx

??? 這里對參數的幾點用法做一些說明:

listName要查詢的List的名稱,也可以為List的GUID,不能為空。
viewName一般都為空。
query標準CAML查詢語句,可以為空,<Query></Query>
viewFields要查詢的字段,可以為空,<ViewFields></ViewFields>
rowLimit返回的記錄條數,默認為100,如果不需要限制,將值設為0 。
queryOptions查詢選項設置,所涉及到的選項比較多,可以參考MSDN。?
http://msdn.microsoft.com/zh-cn/library/websvclists.lists.getlistitems.aspx?
如果要查詢List中Folder下的文檔,則必須添加遞歸選項。?
<QueryOptions>?
?? <ViewAttributes Scope="Recursive" />?
</QueryOptions>
webID可選參數。具體用法查看MSDN。

??? List的GUID可以通過調用Lists.GetListAndView()方法,在返回的報文中獲取到。

http://msdn.microsoft.com/zh-cn/library/websvclists.lists.getlistandview.aspx

4.?搜集到的List中字段的屬性,包括字段的Type。

IDThe ID is a globally unique identifier (GUID) which you should generate for each field. This ID will be used in lists when referencing the site column
TypeThe type indicates the data type of the column and can be of the any following:
AllDayEventThe all day event flag is used in calendar lists.
AttachmentsThe URL of an attachment.
BooleanA boolean indicator with Yes/No.
CalculatedIndicates that the column is a calculated column based on a expression.
ChoiceIndicates that the column is choice from a list of items
ComputedIndicates the field's value is dependant on another field's value.
ContentTypeIdA Content Type ID value.
CounterAn internal unique ID's / counter for each item.
CurrencyA currency value (its format depends on the locale).
DateTimeA Date and Time field.
FileA file object when used in document libraries.
GridChoiceA rating scale as used in surveys
GuidA globally unique identifier.
IntegerAn integer number field.
LookupThe field is a lookup which is a choice, however the choice is from another list.
LookupMultiA lookup field, however multiple selections are allowed.
ModStatAn approval status.
MultiChoiceA choice field, however multiple selections are allowed
NoteMultiple lines of text which can be plain or formatted.
NumberA numerical field which allows decimal places.
PageSeparatorA page separator field, for surveys.
RecurrenceAn indicator that identifies the field as a reoccurring calendar event.
TextA single line of text
ThreadIndexThe ID of a discussion thread.
ThreadingIndicates the field supports threading (in discussions).
URLA Unified Resource Locator (URL) is stored.
UserA person or group.
UserMultiA person or group, however multiple people or groups can be selected.
WorkflowEventTypeContains the type of workflow history event (used in workflow history list).
WorkflowStatusThe status of a workflow is stored.
TitleThe name of the field as displayed in the user interface.? This title may be set using a resource file.
Name(optional) The name of the field which should be guaranteed to never change.? The default is the Title with spaces and invalid characters removed.
StaticName(optional) The logical name of the field which is similar to Name, however this can be programmatically changed.
DisplayName(optional) See title.
Description(optional) A description of the field which will be displayed in front ends.? The description can be placed into a resource file.
Required(optional) Indicates whether or not the field is mandatory. The default is FALSE.
MaxLength(optional) The maximum number of characters allowed.
Hidden(optional) Indicates that the field should be hidden from the interface. If TRUE, this field will not be shown on views or forms. The default is FALSE.
Readonly(optional) The field should be read-only and can be displayed and not edited.? The default is FALSE.
ShowInDisplayForm(optional) Indicates whether the field should be shown on a display form. The default is TRUE.
ShowInEditForm(optional) Indicates whether the field should be shown on an edit form. The default is TRUE.
ShowInListSettings(optional) Indicates whether the field should be shown in the list settings screen. The default is TRUE.
ShowInNewForm(optional) Indicates whether the field should be shown on a New form. The default is TRUE.
ShowInVersionHistory(optional) Indicates whether the field should be shown in the version history of an item. The default is TRUE.
ShowInViewForms(optional) Indicates whether the field should be shown on a view form. The default is TRUE.
Group(optional) A group name allowing you to group fields together.

5.?Customer List中的列名變化?

??? 在Customer List中創建一個新列時,Sharepoint同時給它賦予了內部名稱(FieldInternalName)和外部名稱(FieldName),初始狀態下內部名稱和外部名稱是相同的,當我們修改了List的列名時,外部名稱被修改了,而內部名稱則不變,為了防止在使用時出現找不到列的錯誤,必須在CAML中使用內部名稱作為列名。可以借助CAML工具查找列的內部名稱,也可以在List的新建記錄頁面中查看源代碼,搜索顯示的列名,找到類似于下面的代碼段,FieldInternalName的值即為該列的內部名稱。

<!--?FieldName="Area"?
??? FieldInternalName="Title"?
??? FieldType="SPFieldText"?
-->

6.?兩個小工具,用于檢測或生成CAML,對List的管理和查看報文的具體信息。實際項目應用中會很有用哦:)

U2U Caml Query Builder 2007 v3.1.0.0 (windows version)

Sharepoint Manager 2007

??? CAML的使用過程中還是會遇到很多問題的,以后遇到再逐漸補上吧!


本文轉自Jaxu博客園博客,原文鏈接:http://www.cnblogs.com/jaxu/archive/2009/03/23/1419717.html,如需轉載請自行聯系原作者


總結

以上是生活随笔為你收集整理的对CAML查询语句的几点小记的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 欧美视频免费在线观看 | 手机看片福利视频 | 91在线 | 天天操天天干天天干 | 丝袜福利视频 | 灌篮高手全国大赛电影 | 伊人久久九 | www三级| 红桃av在线 | 人妻视频一区二区三区 | 亚洲美女www午夜 | 久久综合影视 | 中文字幕视频在线播放 | 亚洲第一淫片 | 宗合久久| 国产日韩欧美日韩大片 | 香蕉av一区 | 欧美极品少妇xxxxⅹ免费视频 | 亚洲中文字幕无码av永久 | 天天射天天 | 成人激情视频网 | 黄色性视频 | 最新久久久 | 国产精品一区二区性色av | 99成人国产精品视频 | 成人吃奶视频 | 免费看片成人 | 天天舔天天插 | 欧美成人精品三级网站 | 毛片福利 | 美利坚合众国av | a级大片在线观看 | 国产cao| 欧美肉大捧一进一出免费视频 | 成人黄色在线免费观看 | 亚洲视频第一页 | 懂色av色吟av夜夜嗨 | 精品国产一区二区三区在线 | 波多野吉衣一区二区三区 | 国产视频分类 | 超碰97国产 | 亚洲熟女综合一区二区三区 | 婷婷在线一区 | 国产精品污视频 | 青草视频在线播放 | 成人五区 | 老妇高潮潮喷到猛进猛出 | www.xxx在线观看 | а√天堂8资源中文在线 | 欧美日韩亚洲另类 | 天天拍夜夜操 | 先锋影音中文字幕 | 视频1区 | 亚洲一级视频在线观看 | 一本一道av | 美女无遮挡网站 | 寂寞人妻瑜伽被教练日 | 少妇无套内谢免费视频 | 亚洲综合另类小说 | 3d动漫啪啪精品一区二区中文字幕 | 男人午夜视频 | 一本一道精品欧美中文字幕 | 蜜桃久久精品成人无码av | a网址 | 正在播放木下凛凛88av | 国产富婆一级全黄大片 | 8x8x永久免费视频 | 福利av在线 | 久久精品国产亚洲AV无码男同 | 亚洲女人被黑人巨大进入 | 777久久 | 亚洲一区二区三区四区在线 | 欧美一级二级在线观看 | 91精东传媒理伦片在线观看 | 伊人久久大香线蕉成人综合网 | 成年人黄色av | 一级欧美黄色片 | 久久久久国产精品人妻 | 尤物一区 | av中文资源网 | 欧美爱爱一区二区 | 久久一区二区三区四区 | 在线涩涩 | 日韩天堂在线观看 | 中国黄色小视频 | 黄色国产小视频 | 欧美日韩综合在线观看 | 国产色视频一区二区三区qq号 | 国产精品乱码妇女bbbb | 色涩网站| 色多多av | 午夜色网站 | 色欲欲www成人网站 老色鬼av | 国内免费av | 久久亚洲精选 | 国产精品乱码 | 亚洲永久免费观看 | 日产欧产va高清 | 国产精品久久国产精品99 |