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

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

博客园 - A A

SharePoint 2013 App 未在此网站上启用应用程序的旁加载 SharePoint Error 查询命令 SharePoint 2013 基于主机头创建站点无法访问 SharePoint 2013 APP 之---很抱歉,应用程序已关闭。如果您知道运行服务器的人员,请告诉他们启用应用程序。 SharePoint服务器修改域和机器名 SharePoint 2010 你状态机了吗! SharePoint 文档库打开HTML 直接浏览而不是打开下载对话框 SharePoint Write Logs User Profile Data Web Part 读取属性字段 ECMAScript Client OM(传说中的js客户端编程) - A A 自定义个性化 EditPeople控件 - A A 使用SharePoint Management PowerShell来完成对SharePoint的操作 Developer Dashboard 排忧解难!!! 使用SharePoint 人员选择控件 在 WEB APP开发 - A A SharePoint 在Default 下面添加服务端代码 - A A SharePoint 页面库 使用footer - A A 10分钟搞定 SharePoint 集成FCKEditor 标准项目文档 获取AD用户和OU属性字段名称
CAML 多表查询 SPQuery.Joins and ProjectedFields
A A · 2011-03-21 · via 博客园 - A A

      在实际的SharePoint项目中,业务都比较复杂,其实我们的List一直都支持多表查询的~~

嘿嘿!

Demo:

字典表:

CityState表:  标题(Text)   State(Text)  AreaCode(num)

Locations表:  标题(Text)   City (Text)  zipCode (num)

Customer表:  CustomerName(Text) Address(Text) City(Lookup) State(Lookup)

下面通过SPQuery 进行多表查询(不过Joins 和ProjectedFields 对于字段有很多限制,join的表不支持多行文本,不支持用户或用户组 )

        using (SPSite site = new SPSite(@"http://localhost/"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list1 = web.Lists["Customers"];
                    SPQuery query = new SPQuery();
                    query.Query = "<Where><Eq><FieldRef Name='Title'/><Value Type='Text'>AA</Value></Eq></Where>";
                    query.Joins = @"<Join Type='LEFT' ListAlias='Locations'><Eq><FieldRef Name='City' RefType='ID'/><FieldRef List='Locations' Name='ID'/></Eq></Join><Join Type='LEFT' ListAlias='CityState'><Eq><FieldRef Name='State' RefType='ID'/><FieldRef List='CityState' Name='ID'/></Eq></Join>";//
                    query.ProjectedFields = @"<Field Name='zipCode1' Type='Lookup' List='Locations' ShowField='zipCode'/><Field Name='AreaCode' Type='Lookup' List='CityState' ShowField='AreaCode'/><Field Name='CreateU' Type='Lookup' List='CityState' ShowField='Created'/>";
                    query.ViewFields = @"<FieldRef Name='Title'/><FieldRef Name='City'/><FieldRef Name='zipCode1'/><FieldRef Name='State'/><FieldRef Name='AreaCode'/><FieldRef Name='CreateU'/>";//
                    SPListItemCollection items = list1.GetItems(query);
                }
            }

Joins对应的join的表,ProjectedFields 对应的Join的表的字段

ViewFields 对应的需要显示的字段。。。

稍等继续......