C# 如何通过代码设置内容查询Web部件中的行限制?
我需要一个内容查询web部件,它可以将最近10个修改或添加的文档返回到该特定网站上的任何文档库中 如何按代码添加行限制C# 如何通过代码设置内容查询Web部件中的行限制?,c#,sharepoint,sharepoint-2010,sharepoint-2007,content-query-web-part,C#,Sharepoint,Sharepoint 2010,Sharepoint 2007,Content Query Web Part,我需要一个内容查询web部件,它可以将最近10个修改或添加的文档返回到该特定网站上的任何文档库中 如何按代码添加行限制 ContentByQueryWebPart cqwp = new ContentByQueryWebPart(); cqwp.ContentTypeBeginsWithId = "0x0101008E49C3D400044AB3A2F1DD14073E74F6001D06D12572244BE3A11AAEE3ED
ContentByQueryWebPart cqwp = new ContentByQueryWebPart();
cqwp.ContentTypeBeginsWithId = "0x0101008E49C3D400044AB3A2F1DD14073E74F6001D06D12572244BE3A11AAEE3ED60F576";
cqwp.WebUrl = SPContext.Current.Web.ServerRelativeUrl;
cqwp.Title = "Last Updated Documents";
string query = @"<Where> "+
""+
"</Where>"+
"<OrderBy> "+
"<FieldRef Name='Modified' Ascending='FALSE'/> "+
"</OrderBy>";
cqwp.QueryOverride = query;
cqwp.ListsOverride = "<Lists ServerTemplate='101'></Lists>";
cqwp.WebsOverride = "<Webs Recursive='False' />";
cqwp.ViewFieldsOverride = @"<ViewFields> " +
"<FieldRef Name='Type' Nullable='True' Type='Text'/> " +
"<FieldRef Name='Name' Nullable='True' Type='Text'/> " +
"<FieldRef Name='ContentType' Nullable='True' Type='Text'/> " +
"<FieldRef Name='Modified' Nullable='True' Type='DateTime'/> " +
"<FieldRef Name='Modified By' Nullable='True' Type='Text'/> " +
"</ViewFields>";
mgrPageManager.AddWebPart(cqwp, "Footer", 0);
mgrPageManager.SaveChanges(cqwp);
ContentByQueryWebPart cqwp=新ContentByQueryWebPart();
cqwp.ContentTypeBeginsWithId=“0x0101008E49C3D400044AB3A2F1DD14073E74F6001D06D12572244BE3A11A1AEE3ED60F576”;
cqwp.WebUrl=SPContext.Current.Web.ServerRelativeUrl;
cqwp.Title=“上次更新的文档”;
字符串查询=@“”+
""+
""+
" "+
" "+
"";
cqwp.QueryOverride=查询;
cqwp.listsoferride=“”;
cqwp.WebsOverride=“”;
cqwp.ViewFieldsOverride=@“”+
" " +
" " +
" " +
" " +
" " +
"";
mgrPageManager.AddWebPart(cqwp,“页脚”,0);
mgrPageManager.SaveChanges(cqwp);
也许这个参数会对您有所帮助。?: 也许这个参数会对您有所帮助。?: