example -
SPSiteDataQuery query = new SPSiteDataQuery();
//query Pages libraries
query.Lists = "<lists ServerTemplate='850' />";
query.ViewFields = "<fieldref Name='Title' /><fieldref Name='ID' />";
query.Webs = "<webs Scope='Recursive' />";
DataTable dt = SPContext.Current.Web.GetSiteData(query);
foreach (DataRow row in dt.Rows)
{
string content = string.Empty;
using (SPWeb web = SPContext.Current.Site.OpenWeb())
{
SPList pageslib = web.Lists["Pages"];
SPListItem _page = pageslib.GetItemById(int.Parse(row["ID"].ToString()));
content = _page["PublishingPageContent"].ToString(); -> gets the content on the Publishing Page.
}
}
Ads by Google
No comments:
Post a Comment