Sometimes you need a little sitecore script to get something done real quick. If you’ve got it installed, you could reach for Sitecore powershell, and just use that, but I find the syntax obtuse and the lack of intellisense support to be limiting.
Usually what I do is just toss what I call a script page into the admin section, and use it.
Here’s an example to get you started. I needed to run through all the pages in a folder and set a field to a certain value.
It’s hardcoded here, but you could add
<asp:TextBox> fields as needed to make
it a little bit more generic.
Just drop the page in the
/sitecore/admin folder of your local or development
If you wanted to get really fancy, you could add more logging through a StringBuilder or something. But this is usually good enough for scripting work.
If you need a lot of UI, there are ways to customize the Sitecore ContentEditor application to add your own dialogs, buttons, etc.
It should go without saying, but don’t deploy these to your production sites.
I’m not sure if Sitecore protects everything in
/sitecore/admin by default or
not. Six months from now, I better not be able to google for “Magic Field
Updater Script” and find anything but this post.