문제

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#.

도움이 되었습니까?

해결책

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();
                }

            }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top