SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a blog in my SharePoint site and I forgot to create a well structured hierarchy to drop my files I link into my posts (Word documents, PDF, JPG screenshots,...). Now the blog as been running for a month and I realise I need a library hierarchy to be able to manage the amount of files.

How can I move these files to the new Document Library and also move the reference to these files in my posts? I really do not want to do that manually!

share|improve this question
Are these files already in a Document Library or Site Assets Library? Are you using SharePoint Publishing Pages for your blog? – Daniel Symonds-Lloyd Nov 7 '11 at 11:39
Yes it is a Document Library in a publishing website. – Ucodia Nov 7 '11 at 12:40
up vote 2 down vote accepted

You can write short PowerSell script, which will grab your blog pages content and replace old links to new. I did this few times, it is not enough, but here some basic comandlets to work with SharePoint. Blog post content is field, you can change it programmatically by script and replace links like this:

$web = Get-SPWeb http://web
$list = $web.Lists["Posts"]
$item = $list.Items[0]
$content = $item["Content"]
$item["Content"] = $content.Replace("http://oldlink", "http://newlink")

You can do this in the loop and using diferent masks, if you have not complete correspondance of old and new links. User PowerShell ISE - it's IDE for development scripts to create more complex scripts.

share|improve this answer
Thanks for the advice, I will give it a try. – Ucodia Nov 7 '11 at 23:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.