0

I have a SharePoint 2013 on-premises site. I've been asked to import a Document Library from an old SP2010 site. The Document Library to be imported has standard metadata (Modified by and Modified date) and I need to retain this.

The person who created this Library also added a Comments column, and a Hyperlink column. The hyperlink column points to a different folder/file - a scanned pdf version of the listed Word document.

While the other metadata must be preserved after the import, the Hyperlink column needs to be updated to point at the new site rather than the old site.

E.g., an entry for a document might read: Name__________________Comments_______Hyperlink__________Modified

BusinessPlan2016.docx Sample comment http://oldsite/policies/pdfversion/plan2016.pdf

and I need to update this so that the URL now reads http://newsite/policies/pdfversion/plan2016.pdf

Is there an easy way to do this globally? The Doc Library contains several subfolders, each with their own documents, so doing this manually will take too long.

I'm an IT admin with limited SharePoint 2013 experience thus far.

0

Basically you need to do a substring replacement in one particular field of each item in the document library. I would do this with PowerShell:

$web = Get-SPWeb "<Web_URL>"
$list = $web.Lists["<Library_name>"]
$fieldname = "<Field_name>"
$list.Items | % { $_[$fieldName] = $_[$fieldName] -replace "<old_substring>", "<new_substring>" ; $_.Update() }
  • thanks for the help, that worked for me. Much appreciated. – Anton Sweeney Mar 24 '16 at 12:25
  • Please mark as an answer :-) – Rustam Mar 25 '16 at 14:08
  • Sorry, done now. Am fairly new to Stackexchange - it's not obvious that one has to click on the grey-on-white tickmark... – Anton Sweeney Mar 26 '16 at 15:15

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.