Updating AutoroutePart.Path of a ContentItem Programatically

Topics: Writing modules
Sep 13, 2014 at 11:36 PM

I have too many content items in a web site.
I realized that they need an AutoroutePart, I added the AutoroutePart to the ContentItem, but the thing is that i will have to manually go inside all the 200+ content items using the backend and save them again to force an orchard update, and so, generating the Autoroutepart Path for each content item.

I want to update all the Autoroute parts using code!!

So far, i have been trying to create an Editor for each content item using UpdateEditor but. Then i implement the interface IUpdateModel, but don't know how to avoid to loose the contentparts info.

Sep 15, 2014 at 1:57 AM
One way you could fix that is by creating a custom command (look at existing commands for examples) and have your command iterate over all content items that have the AutoroutePart attached (and for which no alias exists yet, as you might not want to override any existing aliases).

Regarding the second part of your question, I am afraid I don't understand what you're saying or asking.
Sep 17, 2014 at 4:28 PM
What i am trying to explain in second part is that i am trying to use orchard content management methods and mvc interfaces to solve the issue but no luck.

I think that doing it thru commands is a nice idea!

I will try!

Thx walker!