c# - In Umbraco 6, what is the best way to save and publish a list of nodes with ContentService? -


i'm writing simple function updates/creates nodes xml data-source (about 400 nodes) , i'm wondering best way save , publish nodes is. i've noticed can save list of nodes there's no saveandpublish equivalent.

should iterate on list , call saveandpublish each node or there better way? if there alternative, there difference in terms of performance?

any answers appreciated!

you correct there no publish or saveandpublish option takes in ienumerable save method. handy save lines of code.

the valid option achieve want following.

var cs = applicationcontext.current.services.contentservice; foreach(var content in yourlistofcontentitems) {     cs.saveandpublish(content); } 

saving list before publishing calling save method isn't going make differences if umbraco detects there new content in list processes each individually. , can tell doing , calling publish after not going save cycles either because publish method calls same saveandpublishdo method saveandpublish calls. might go straight end result.


Comments