Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alex Gill 26 posts 61 karma points
    Dec 02, 2013 @ 12:49
    Alex Gill
    0

    Add a Content node or ContentType at the root using the API

    The constructors and factory functions for Content and ContentType all require a reference to a parent or parent Id. An exception is thrown if I try to pass null as a parameter. How can I add a content node - or a ContentType - at the root (which has no Id)?

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Dec 02, 2013 @ 14:35
    Kevin Jump
    100

    you should beble to create at the root by passing -1 as the parent id.

    using the content Service

    IContentService contentService = ApplicationContext.Current.Services.ContentService;
    IContent content = contentService.CreateContent(name, -1, nodeType); 
    
  • Alex Gill 26 posts 61 karma points
    Dec 02, 2013 @ 15:45
    Alex Gill
    0

    That worked perfectly, thanks

Please Sign in or register to post replies

Write your reply to:

Draft