问题描述
如何从讨论区获取项目?我尝试了以下代码,但没有获取任何记录
How to fetch the items from discussion board? I tried the below code, but no records are getting fetched
var q = new SPQuery()
{
Query = @"<Where><Or><Eq><FieldRef Name='Created' /><Value Type='DateTime'><Today/></Value></Eq><Eq><FieldRef Name='Modified' /><Value Type='DateTime'><Today /></Value></Eq></Or></Where>"
};
SPList oList = oWeb.Lists["Test Discussions"];
SPListItemCollection collection = oList.GetItems(q);
for (int i = 0; i < collection.Count; i++)
{
string body = oList.Items[i]["Body"].ToString();
string author = (string)oList.Items[i]["Author"];
string editor = (string)oList.Items[i]["Editor"];
}
}
所有讨论项都在每个主题"下.到今天为止,我已经将10个讨论添加到该列表中.但是没有任何记录.
All the discussion items are under each "Subject". I have 10 discussions added to it the list as of today. But no records are fetched.
如何获取讨论内容?
How to fetch the discussions ?
谢谢
推荐答案
每个新的讨论都由扩展文件夹表示.查看本文,以更好地了解讨论区内部:讨论区和内容类型.这是例如有关如何以编程方式检索讨论和答复的示例:以编程方式阅读讨论区和讨论区答复.
each new discussion is represented by extended folder. Check this article for better understanding of discussion boards internals:Discussion Boards and Content Types. And this for example of how to retrieve discussions and replies programmatically:Programmatically Read Discussion Board & Replies.
这篇关于从讨论区获取项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!