您的位置:首页 > 其它

sharepoint 2010 获取讨论板话题的所有评论回复信息 Get all replies

2013-02-03 16:54 344 查看
前面提到在sharepoint 2010 如何给讨论板(Discussion)话题添加回复(Reply)信息(Message)

以下是如何通过程序,获取这些所有回复信息。

SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                SPWeb web =
SPContext.Current.Web;
                SPList list = web.Lists["工作组讨论"];
                //This Query gets all items of the topic with ID=1
                string str =
@"
                <Where>
                    <Eq>
                        <FieldRef Name=""ParentFolderId"" />
                        <Value Type=""Integer"">1</Value>
                    </Eq>
                </Where>
                ";
                SPQuery query =
new SPQuery();
                //This line makes the query search ib all folders
                query.ViewAttributes =
"Scope=\"Recursive\"";
                query.Query = str;
                SPListItemCollection res = list.GetItems(query);
                DataTable replyTable = res.GetDataTable();
                DataList1.DataSource = replyTable;
                DataList1.DataBind();
            });
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐