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!

  • 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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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