You get the error “Method not found: ‘Void Microsoft.SharePoint.Client.Conten tTypeCreationInformation.set_Id(System.String)’”

Problem

You get the error message “Method not found: ‘Void Microsoft.SharePoint.Client.ContentTypeCreationInformation.set_Id(System.String)’” when trying to create content types using CSOM. You are specifying the ID of the content type(s) you are creating.

Reason

SharePoint 2013 CSOM API did not have support for specifying the ID of content types on creation when using the Microsoft.SharePoint.Client.ContentTypeCreationInformation method of creating content types before Service Pack 1.

SP1 for SharePoint 2013 includes various fixes as outlined in the post CHANGE: Service Pack 1 for Office 2013 and SharePoint 2013.

One of the fixes includes:

SharePoint 2817429​ Developers are unable to specify a Content Type ID when creating Content Types in the client object model.

Which I’m pretty sure refers to the changes in the API added with SP1.

Note: SharePoint 2010 did not have the possiblity to specify ID of content types either.

Solution

Most likely the problem is that the environment does not have SP1. Update your SharePoint environments to Service Pack 1, or find another means of creating content types.

A less likely solution: The code is picking up the dlls from SharePoint 2010 which doesn’t have the function either. In this case it probably means that you’re installing on an environment with the wrong version of SharePoint.

Leave a Reply

Your email address will not be published. Required fields are marked *