Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've created a Contenttype and some fields in a visual studio project. They are deployed when activating the "Content types"-feature. But here's the problem: I want them to be deployed to the Content Type HUB (in Office 365). Deploying itself isn't a problem but I also want the content-types to be published, so I can use them in my other sitecollections.

I guess I'll need to do this with the client object model with a feature receiver? Is there anyone who has an example how to do this? (Or if there's a better way to do this, please say so...)

Thanks a lot!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I don't think client side object model is a good idea. I think you need to publish them using code written in a feature receiver. Please see the link below...

http://blogs.msdn.com/b/chaks/archive/2011/09/04/content-type-hub-publishing-and-subscribing-to-content-types-programmatically-c-code.aspx

share|improve this answer
add comment

Hi Here is a example how to create a custom content type and add it to 365

ClientContext clientContext = new ClientContext("http://anmol-pc");

Web web = clientContext.Web; ContentTypeCollection contentTypes = web.ContentTypes; clientContext.Load(contentTypes); clientContext.ExecuteQuery();

ContentTypeCreationInformation newConInfo = new ContentTypeCreationInformation();
newConInfo.Name = "MyFirstContentType";
newConInfo.ParentContentType = contentTypes.GetById("add parent content ID");
newConInfo.Group = "My Group";

//Create
ContentType newContent = contentTypes.Add(newConInfo);
clientContext.ExecuteQuery();
share|improve this answer
    
That's not really the problem. I can create the contenttypes, but I don't know how to publish them (It's on the content type hub sitecollection) Thanks anyways –  Ruben Herman Dec 1 '11 at 7:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.