问题描述
我想从定期会议工作区中的特定列表中获取所有项目.我尝试执行以下CAML:
I want to get all items from a specific list in recurring meeting workspace. I tried to execute the following CAML:
<Query>
<Where>
<IsNotNull>
<FieldRef Name='ID' />
</IsNotNull>
</Where>
</Query>
但是它仅显示即将举行的会议的数据.
But it only displays data for the upcoming meeting.
但是,当我打开列表时,可以从操作菜单中选择显示所有会议的数据.这使我认为这是可能的.我知道我可以将列表转换为系列项目,以便它们出现在所有会议中,但这不是我想要的.
However when I open list, from actions menu I can choose to display data from all meetings. That makes me think it is possible. I know I can convert the list to series items so they appear in all meetings, but it is not that I want.
推荐答案
Yeehaaw!
最后我找到了解决方案! SPQuery 类具有属性 MeetingInstanceId ,您可以为其分配一个特定InstanceID的值(例如20090615表示2009年6月15日的项目),或查询所有项目,您必须为其分配 SPMeeting.SpecialInstance 枚举值(不要忘记将其转换为int).
Finally I found a solution! SPQuery class has a property MeetingInstanceId, which one you can assign a value of a specific InstanceID (for example 20090615 for 15 June 2009 items) or to query all items you must assign it SPMeeting.SpecialInstance enum value (don't forget to cast it to int).
然后,您只需执行查询即可从所需的任何工作空间中获取项目.
Then you just execute your query to get items from whatever workspace you want.
哦,别忘了
using Microsoft.SharePoint.Meetings;
或者您可以省略使用SPMeeting.SPecialInstance,但是直接使用从-3到0的整数
Or you can ommit using SPMeeting.SPecialInstance, but use integeres directly from -3 to 0
示例代码:
using(SPSite site = new SPSite(<enter your workspace url>))
using (SPWeb web = site.OpenWeb())
{
SPQuery query = new SPQuery();
query.MeetingInstanceId = (int)SPMeeting.SpecialInstance.AllButSeries;
query.Query = @"<Query>
<Where>
<IsNotNull>
<FieldRef Name='ID' />
</IsNotNull>
</Where>
</Query>";
SPList list = web.Lists[<enter your list>];
foreach (SPListItem item in list.GetItems(query))
{
Console.WriteLine(item[item.Fields.GetFieldByInternalName("Title").Id]);
}
}
花了很长时间才找到.网上可能没有太多关于此问题的信息,或者我没有选择正确的关键字,但无论如何应归功于此来源,是关键字的获取所有列表项共享点的第一位"工作区重复".
It took so much time for this to find. Probably not too much info on the net for this issue or I didn't choose the right keywords, but anyway credit to this source for getting in the first place for keywords "get all list items sharepoint workspace recurring".
我希望这对其他人有帮助.
I hope this helps others.
这篇关于在会议工作区中,以编程方式从列表中获取所有议程项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!