This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (SPLimitedWebPartManager webPartManager = SPContext.Current.Web.GetLimitedWebPartManager("SitePages/CRISP/Home.aspx", System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared)) | |
{ | |
ContentByQueryWebPart cqwp = new ContentByQueryWebPart(); | |
cqwp.ContentTypeBeginsWithId = "0x0101006F0A470EEB1140E7AA14F4CE8A50B54C0001CB1477F4DD432AA86DD56CC3887AF40902"; | |
cqwp.WebUrl = web.ServerRelativeUrl; | |
cqwp.MainXslLink = "/Style Library/XSL Style Sheets/ContentQueryMain.xsl"; | |
cqwp.Title = "Recently Published"; | |
webPartManager.AddWebPart(cqwp, "Top", 1); | |
webPartManager.Web.Dispose(); | |
} |
2 comments:
How to get data from specific list or library into the above added CQWP?
You need to set the WebUrl, ListGuid, and ListName properties of the CQWP to get data from a specific list.
Post a Comment