Copied to clipboard

Flag this post as spam?

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


  • Nikhil Prajapati 14 posts 125 karma points
    Aug 10, 2022 @ 14:09
    Nikhil Prajapati
    0

    How to update the multiple site content while publishing the master site content?

    Hello Awesome people,

    I have one quick concern about the content service in Umbraco V7 with multi site content publish.

    I am working on Umbraco V7.x where I would like to save & publish same content to other 2 sites on same solution. We have same schema in all sites, And I need to update like if the schema is same in other 2 sites, then on click of Master site, I want to save & publish same content on that 2 sites as well.

    Here I am facing issue is, In V7, I am getting data in IContent, As it is returning only Json format content, so I want to convert it to modelbuilder(as a IPublishedContent)

    As I did it in Umbraco V8 already, but Is there any way to achieve it in Umbraco V7?

    Looking forward to hear from lovely community.

  • Nikhil Prajapati 14 posts 125 karma points
    Aug 31, 2022 @ 13:41
    Nikhil Prajapati
    100

    Hello Awesome people

    I found a way to get the data in a published event (ContentService.Published) in Umbraco V7. In case anyone needs the solution can refer to this.

    You can use the UmbracoHelper inside the Published Event.

    var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); 
    

    With this, you will get the UmbracoHelper method which will allow you to find the content as IPublishContent.

    var ContetnData=umbracoHelper.TypedContent(ContentId);
    

    The above line returns the IPublishContent and then you can convert it into the specific Document type and now it is easy to get your content.

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft