0

How can I find out the title of ContentType based on the ContentTypeId, with Sharepoint 2010 Client Object Model(C#).

I have ContenttypeId, I need the title.

I just need to know, is there a way?

Thank you

Update:

ContentType contentType = clientContext.Web.ContentTypes.GetById("0x010100E745619457D78E46A59B025F467563CD00297A349446A47947AA416D334547CC72"); clientContext.Load(contentType); clientContext.ExecuteQuery(); 

I have tried with GUID as well in the GetByID()..

I get this error:

Cannot invoke method or retrieve property from null object. Object returned by the following call stack is null. "GetById ContentTypes Web Microsoft.SharePoint.SPContext.Current " 
1
  • Thank you for the code. How did you get the content type id ? I think it is a content type ID that comes from a list. Commented Jan 11, 2014 at 21:28

1 Answer 1

0

You can request the content type be id via the client object model using the function: ContentTypeCollection.GetByID

Just pass your content type id and if it could be found the you will get the content type.

1
  • So and nothing was returned after you tried contentType.Name? can you please add more code to your original questions so that I can reproduce your steps. It seems like this is a list content type. Commented Jan 11, 2014 at 19:44

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.