Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentTypeDefinition should work correctly under SP2010 CSOM #887

Closed
SubPointSupport opened this issue Sep 16, 2016 · 1 comment
Closed

Comments

@SubPointSupport
Copy link
Contributor

The following content type does not get a correct ID while being provisioned under SP2010 CSOM runtime

var customerAccountContentType = new ContentTypeDefinition
{
Name = "Customer Account Folder", 
Id = new Guid("79BA14EB-F497-4637-A95D-83D0F3BCB949"),
ParentContentTypeId = BuiltInContentTypeId.Folder,
Group = "POC"
};

https://www.yammer.com/spmeta2feedback/#/threads/show?threadId=669703732

Correct ParentContentType property has to be used.

@SubPointSupport
Copy link
Contributor Author

Fixed for SP2010, tested on the following model.

Please be aware that SP2010 CSOM does not support content type creating with predefined ID. Hence, SPMeta2 fallback on content types names. SP2010 port has not been tested under SharePoint so that there might be other issues.

var customerAccountContentType = new ContentTypeDefinition
            {
                Name = "Customer Account Folder",
                Id = new Guid("79BA14EB-F497-4637-A95D-83D0F3BCB949"),
                ParentContentTypeId = BuiltInContentTypeId.Folder,
                Group = "POC"
            };

            var customerAccountItemContentType = new ContentTypeDefinition
            {
                Name = "Customer Account Item",
                Id = new Guid("932e02da-477a-48ff-8f4d-4c161d0f0df8"),
                ParentContentTypeId = BuiltInContentTypeId.Item,
                Group = "POC"
            };

            var doc = new ContentTypeDefinition
            {
                Name = "Customer Account Doc",
                Id = new Guid("718325f2-6554-4b52-9e7d-7b1b7f704725"),
                ParentContentTypeId = BuiltInContentTypeId.Document,
                Group = "POC"
            };

            var siteModel = SPMeta2Model.NewSiteModel(site =>
            {
                site.AddContentType(customerAccountContentType, ct =>
                {
                    ct.AddContentTypeFieldLink(BuiltInFieldId._Category);
                    ct.AddContentTypeFieldLink(BuiltInFieldId.AssignedTo);
                    ct.AddContentTypeFieldLink(BuiltInFieldId.OtherFaxNumber);
                });
                site.AddContentType(customerAccountItemContentType);
                site.AddContentType(doc);
            });

            using (var clientContext = new ClientContext(siteUrl))
            {
                var csomProvisionService = new CSOMProvisionService();
                csomProvisionService.DeploySiteModel(clientContext, siteModel);
            }

@SubPointSupport SubPointSupport modified the milestones: 1.2.90 release, 2016.10.03, 1.2.90 Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant