SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that I have to use

SPSite site = new SPSite("SPsite Path");
SPWeb web = site.OpenWeb();
SPList contacts = web.Lists["Listname"];

if I need to get content of a List, but how do I read data from the pagecolumns of the page I am currently on?


                   foreach (SPListItem item in SPContext.Current.ListItem.ListItems)

                    output.Write(item[io] + "|" + io + "<br/>");


Does give me: 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39005A81DBCD88A1A24FA0B25F46F1AEC15500FAC7433996C57149A6320A1777FA6771|0

share|improve this question
up vote 3 down vote accepted

SPContext.Current.ListItem["ColumnName"] should do it

share|improve this answer
Does give me: 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39005A81‌​DBCD88A1A24FA0B25F46F1AEC15500FAC7433996C57149A6320A1777FA6771|0 – fr34kyn01535 Dec 7 '11 at 15:03
Please post more of your code - in particulr where that io variable comes from, your result is that's the value of the Content Type column, and it's showing a content type of a custom Page Layout. – James Love Dec 7 '11 at 15:09
Argh.... i just want to access the Pages' columns which are inheriting from my custom Content Type.. The io is just an increasing int.. (started at 0)... ... I have a field called "Contact" in my Content Type and set this column through a field i added in my page-layout.. Now i want to read this field on the page i am in my wp. – fr34kyn01535 Dec 7 '11 at 15:16
Then have you tried SPContext.Current.ListItem["Contact"] ? – James Love Dec 7 '11 at 15:36
Ya this works... well.. the listing not but a'm okay with that solution. Thank you. – fr34kyn01535 Dec 8 '11 at 10:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.