I am working on an event receiver inside my Enterprise wiki site collection inside SharePoint 2013. Now inside my event receiver I am trying to do the following:-
Find specific wiki page (by title, Name or UL).
For this page get its HTML Source code. Similar to the HTML source code I get when I edit a wiki page, click on “Edit Source” button.
Now I have the following code inside my event receiver, where I am able to get all the wiki pages, but seems trying to get a wiki page by title or by name is not working using the indexer,, as the PublishingPage pp
variable inside my code will always be null..
public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
SPWeb spCurrentSite = properties.OpenWeb();
if (properties.List.Title.ToLower() == "customers")
{
PublishingSite pSite = new PublishingSite(properties.Site);
SPContentType ctype = pSite.ContentTypes["Enterprise Wiki Page"];
PageLayoutCollection pageLayouts = pSite.GetPageLayouts(ctype, true);
PageLayout pageLayout = pageLayouts["EnterpriseWiki.aspx"];
PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(properties.Web);
PublishingPageCollection pPages = pWeb.GetPublishingPages();
//
int t = pPages.Count;
PublishingPage pp = pPages["Test - Main"];// I have a wiki page with title= “Test – Main”
so can anyone adivce if there is a way to get a specific wiki page by title,name or url and for this wiki page to get its HTML source?
Thanks