Copied to clipboard

Flag this post as spam?

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


  • Vladimir 1 post 71 karma points
    Sep 02, 2017 @ 22:55
    Vladimir
    0

    Create composite content programmatically

    I've composite Content Type "Forecast" which has link on another ContentType "Text"

    generated c# class for "Forecast" content type has following code:

        public IPublishedContent FText
        {
            get { return this.GetPropertyValue<IPublishedContent>("fText"); }
        }
    

    The goal is to create many forecasts and texts for them programmatically.

    I've found that Umbraco provides developers with ContentService API for working with it's entities. To create new Text entities I use methods: var t = ContentService.CreateContent(name, parentId, alias) ContentService.SaveAndPublishWithStatus(t);

    And I tried to use these methods to create Forecast entities, but I've got a problem because I can't assign Texts on Forecasts

    Any ideas?

Please Sign in or register to post replies

Write your reply to:

Draft