Question

I have created the SharePoint custom page called "Finance.aspx".I have changed the page title as 'Finance page'.i need to the current page title from page properties using c# code.

please suggest any idea to get the page properties using c#.

Était-ce utile?

La solution

First add Microsoft.SharePoint.Publishing; reference to your solution

 SPWeb web = SPContext.Current.Web;
 PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
 PublishingPageCollection pages = publishingWeb.GetPublishingPages();
            foreach (var page in pages)
            {
                if (page.Name == "your page name")
                {
                    string title = page.Title;
                    string desc = page.Description;
                    string createdBy = page.CreatedBy.ToString();
                }

            }
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top