c# - Moving newly created publishing page to top in MOSS 2007 programmaticaly -
i stuck problem 1 day now: in application, create publishing page in code:
publishingpage newpage = pages.add(usablename, layout); newpage.listitem["title"] = promorecord.promotionname; newpage.listitem["description"] = string.empty; newpage.update(); newpage.checkin("first draft");
so far good. problem is, need newly created page appear @ top of navigation. naive enough think simple this:
spnavigationnodecollection navigationnodes = pweb.currentnavigationnodes; spnavigationnode newnode = null; foreach (spnavigationnode node in navigationnodes) { if (node.url.equals(prefix + newpage.url, stringcomparison.ordinalignorecase)) { newnode = node; } } newnode.movetofirst(navigationnodes);
would work. doesn't, because page not there (in currentnavigationnodes collection). tried with:
newnode = new spnavigationnode(promorecord.promotionname, prefix + newpage.url); navigationnodes.addasfirst(newnode);
with no luck either - here got exception saying can't add page because it's in draft state. actually, currentnavigation seems updated when go frontend management (manage content , structure / site administration / navigation) - , page appears there. if it's in draft mode.
i tried lot of things no success... maybe guys have idea try?
thanks lot in advance!
Comments
Post a Comment