Copied to clipboard

Flag this post as spam?

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


  • Pradeep 39 posts 158 karma points
    Dec 02, 2015 @ 05:01
    Pradeep
    0

    How Change Content Page Template Via C# programming API

    Hi Guys,

    I have some issue in my Umbraco Website. I have two nodes of same item but both items having different template.

    Example Like

    1. Product ( template = product-item)
    2. Store Product ( template = product-item)

    Now I want to change the product template to pproduct-item. There are 10000 thousand sub node under this so it's not possible do it manual, bcoz its also having child that are using different template too.

    IContent mynode = ApplicationContext.Current.Services.ContentService.GetById(item.Id);
    mynode.ContentType.DefaultTemplate.Content = "sometemplate";
    ApplicationContext.Current.Services.ContentService.SaveAndPublishWithStatus(mynode,0);
    

    Also how I can add images via API in media picker at the node.

    I was tried to change template via content service but it's not working. So please Guys if anyone can help me.. I really appreciate it .

    Thanks Waiting for reply

  • Pradeep 39 posts 158 karma points
    Dec 13, 2015 @ 04:39
    Pradeep
    0

    anyone who can help ?

Please Sign in or register to post replies

Write your reply to:

Draft