SubPointSolutions / spmeta2

SharePoint artifact provision for .NET platform. Supports SharePoint Online, SharePoint 2019, 2016 and 2013 via CSOM/SSOM.
http://subpointsolutions.com/spmeta2
133 stars 56 forks source link

Can't rename Content Type #1113

Closed jarzimichal closed 6 years ago

jarzimichal commented 6 years ago

Hi there,

I have a problem with renaming Content type on SharePoint on Premise 2016 (16.0.4351.1000)

I have a definition of ContentTypeDefinition for my Content Type and that CT has been already deployed to Site using spmeta2. Now I need to change the name of that CT, so I have modified my ContentTypeDefinition.Name property and run code again:

var model = SPMeta2Model.NewSiteModel(site =>
{
    site
       .AddContentType(<myContentType>)
}); 

I would expect that spmeta2 will change the name of the Content Type by comparing the model properties with previously deployed Content Type properties.

The current behavior is that Name property is not changed after running my code...

SubPointSupport commented 6 years ago

@jarzimichal we'll look into details and come back on this. We may not allow content type renaming, will confirm this.

Meanwhile, what's the version of SharePoint, CSOM/SSOM, and SPMeta2 is in question? We had this in the issue template, need to know to solve this faster for you.

jarzimichal commented 6 years ago

Hi @SubPointSupport - I have edited my bug by adding SP version: It's SharePoint on Premise 2016 (16.0.4351.1000)

SubPointSupport commented 6 years ago

In both CSOM/SSOM implementations, SPMeta2 tries to find a giving content type by its ID, then Name.

If content type cannot be found, then a new content type will be created. If target content type exists and resolved by its ID, then the Name property will be updated as per the giving definition. Consequent deployments remain the target content type exactly how the definition looks like.

@jarzimichal will close this ticket for the time being. Feel free to re-open, happy to troubleshoot this further but we would need content type definition, the model and additional information on SP/SPMeta2 versions/API as per the github ticket template.