Friday, January 22, 2010

A neat little object ..... ContextPageInfo

SharePoint 2010 exposes a ContextPageInfo object that enables easier access to get commonly used properties such as the list id of the current page and the item id. We can also determine whether the current page is ghosted or not.

SPContext.Current.ContextPageInfo.ListId
- Returns the current list id of the pages library/list where the page is stored.

SPContext.Current.ContextPageInfo.ItemId
- Returns the current item id for the item stored in the the pages library/list

SPContext.Current.ContextPageInfo.GhostedPage
- Used to determine if the page is ghosted or not.

These are not that flash hot, but useful at times !

No comments: