I've moved my Sharepoint 2007 to a new server, where the images used in wiki pages now have a different url.

Is there a way where I can change the url for all documents (dbo.AllDocStreams.Content)?


Do a replace of http://oldserver/images/screen1.png to http://newserver/images/screen1.png

3 Answers 3


You could achieve this via PowerShell.

Get the content of the wiki page as html

 $wpPage = $web.GetFile("SitePages/home.aspx");
 $wikiContent = $wpPage.Item["Wiki Content"];

Parse html content in a html object like this:

$html = New-Object -ComObject "HTMLFile";
$source = $wikiContent;

Get all the links of the wiki page and alter them

$links = $html.links | Where-Object {$_.href -match "http://myOldSharePoint/*"} | { $_ -replace "http://myOldSharePoint", "https://myNewSharePoint"}

Save the content of the html object back into the spItem

$wpPage.Item["Wiki Content"] = $html.
# sorry I don't have the appropiate code at hand

Save SPItem


Also this link might help

  • Don't you think a simple $wikiContent.Replace() would be sufficient? Is there a real need to parse the string as HTML?
    – Evariste
    Jun 21, 2016 at 8:45
  • You are essentially right, but the nice thing about parsing is, that you can do it in a piped operation (with filters). So in my opinion it is a little more specific than only replace. On the other hand... in this scenario where you only want to replace the domain, replace is probably better :)
    – Nils
    Jun 21, 2016 at 9:21

It's hard to bulk update the links in wiki pages as per different blogs.

Migrate your old Wiki Pages into new Enterprise Wiki Pages. This means taking the wiki page content and copying it in the "Page Content" field in most cases of an Enterprise Wiki page. This can be done manually, one by one but can take up a very long time. You need to make sure all hyperlinks to images, documents follow to the new URL as well. Again you could use a tool like Sharegate as it copies content assigns properties like a new content type and corrects the link. Perfect for this situation.

If you want to do bulk update all the links in wiki pages then you should read below article atleast once.

Bulk Update (or Redirect) of SharePoint Wiki Links ... Can it be Done?

  • Is above solution helps you to get the desired solution? If not than let us know so we can help you further on the same. Thanks.
    – Hardik
    Jun 21, 2016 at 9:04

Add the script file to master page, then add the relevant code in JavaScript to change the path which will full fill your requirement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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