SubPointSolutions / spmeta2

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

Is there any way to rename content type assigned to list. #1081

Open HeToC opened 7 years ago

HeToC commented 7 years ago

After assigning content type to list (actually sharepoint creates new list scoped content type based of the first one) its unable to rename it. (or assign new name while adding the link.

example:

            var baseContentType= new ContentTypeDefinition()
            {
                **Name = "Site scoped content type**",
                Id = new Guid("89a9424f-25ab-411c-9001-afbf5291b78a"),
                ParentContentTypeId = BuiltInContentTypeId.Item,
                Group = "Test group"
            };

            web.AddList(lstProjectJoural, list =>
                {
                    list
                        .AddContentTypeLink(new ContentTypeLinkDefinition {
                            ContentTypeId = baseContentType.GetContentTypeId(),
                            **ContentTypeName = "Descendant list scoped content type"**
                        })
                });
SubPointSupport commented 7 years ago

Not at the moment, renaming content type within a list isn't supported yet.

First of all, can't see this feature being popular or demanded. Secondly, it would be a bit confusing within SPMeta2 usage - first we'd need to add a content type, and then add another definition or something to rename it. Another way around is to update the name is only it was resolve by ID.. but in this case, we wouldn't know if it was a resolution by Name or ID. Becomes confusing and might potentially raise tons of unexpected errors.

SubPointSupport commented 7 years ago

Maybe, at ContentTypeLinkDefinition, we might enable Name property update if only resolution worked well by ID.

Would it be sufficient, @HeToC ? But again, could be a potential way to get into troubles.

HeToC commented 7 years ago

i think that would be good enough. There wont be any potential troubles in renaming list scoped content types.