I'm using the SharePoint 2010 Managed Client Object Model to retrieve a list of listitems:

      string formattedDate = theDate.ToString("yyyy-MM-ddTHH:mm:ssZ");
            CamlQuery absenceQuery = new CamlQuery();
            absenceQuery.ViewXml = "<View><Query>" +
                "<Where><Eq><FieldRef Name='AbsenceDate'/><Value Type='DateTime' IncludeTimeValue='FALSE'>" + formattedDate + "</Value></Eq></Where>"
                + "</Query>"
   + "  <FieldRef Name='Employee' /><FieldRef Name='AbsenceDate' /><FieldRef Name='AbsenceTime' /><FieldRef Name='ContentType' />"
   + "</ViewFields>"
            ListItemCollection absences = clientContext.Web.Lists.GetByTitle("Absences").GetItems(absenceQuery);

I need to include the ContentType in the results so I tried changing that last line to

                items=> items.Include(

The ContentType Name was not included in the results. When I tried to access it throws PropertOrFieldNotInitializedException.

I found a link here http://msdn.microsoft.com/en-us/library/office/ee534956(v=office.14).aspx that says Because this example uses the Include(IQueryable, []) method, only the specified properties are available after query execution. Therefore, you receive a PropertyOrFieldNotInitializedException if you attempt to access other properties beyond those that have been specified. In addition, you receive this error if you attempt to use properties such as ContentType or ParentList to access the properties of containing objects.

Anybody know how to retrieve the Items with the contentType name?

1 Answer 1


In order to retrieve ContentType property for ListItem it should be specified as demonstrated below:

clientContext.Load(listItems,items=> items.Include(item=>item.ContentType));

but in your case the list of fields that should be retrieved are also explicitly specified via Query using ViewFields element:



In addition to

clientContext.Load(listItems,items=> items.Include(item=>item.ContentType));

specify also FieldRef element for ContentTypeId in query:

<View><Query></Query><ViewFields><FieldRef Name='ContentTypeId' /></ViewFields></View>
  • To get ContentType field, you must include into ViewFields ContentTypeId (Worked also in SPOM).
    – dbardakov
    May 7, 2014 at 7:21
  • Added both ContentType and ContentTypeId into ViewFields in the CAML query, added items.Include(i=>i.ContentType) before Load and ExecuteQuery but I am still receiving ListItems without ContentTypes, any idea what I could be doing wrong?
    – michalh
    Aug 9, 2018 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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