Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a wiki library which contents is automatically copied onto another site. Some of the pages in the library contain images, the links to those images are relative.

Example:

page: http://www.siteA.com/wiki/pages/home.aspx

image: /wiki/images/image.jpg

Now I have a script which exports the wiki and images libraries, and imports them on another site. But on that site, the library is placed in a different subsite:

http://www.siteB.com/subsite/wiki/pages/home.aspx

Now although the images library is in the same subsite as the wiki (like it was on siteA), the images still break. They keep on pointing to /wiki/images/image.jpg instead of /subsite.wiki/images/image.jpg.

So now I'm looking for a way to correct this, preferably in a powershell script, since the exporting / importing is done in powershell too. What's a good way of doing this?

share|improve this question
    
Have you tried to use url token.For e.g. {SiteUrl}. I am not sure it work in wiki page –  Amit Kumawat Nov 18 '11 at 16:21

2 Answers 2

up vote 3 down vote accepted
+50

Jasper,

You could try modifying the content from each wiki page through powershell by replacing the old URL with the new one.

The following blog post can help you with it: http://jrich523.wordpress.com/2011/11/14/modify-a-sharepoint-2010-probably-2007-as-well-wiki-page-with-powershell/

$content = $wiki.data.row.ows_WikiField
$content = $content -replace "/wiki/images/", "/subsite/wiki/images/"

Regards, EStruyf

share|improve this answer

For future readers: I created a Powershell script which does the same, but without the need to use the webservices. http://blog.repsaj.nl/?p=434

share|improve this answer

Your Answer

 
discard

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.