locked
Hyperlink Mass Update RRS feed

  • Question

  • We have a Sharepoint List (MOSS 2K10) that contains a hyperlink path to a network drive.  We are changing server locations for this path and need to change all the hyperlinks to point to the new server.   There are a few thousand entries that need to be updated.,

    i.e. change hyperlink \\server1\masters\...  to \\server2\masters...

    We tried opening the list in Access and we can change the text from server1 to server2 with Find and Replace All, but it only changes the Description.  The actual url does not change.

    Hoping for an easy solution

    EK

    Wednesday, May 30, 2012 4:25 PM

Answers

  • I have to respectfully disagree with Rao's assertion that PowerShell will only help you with this issue if you have access to the SharePoint server. I would say instead that PowerShell can do it if you don't (by using the List.asmx web service rather than the Object Model), but that it will be much easier if you are able to run it on the server and take advantage of the SharePoint Object Model.

    If you can run it on the server, something similar to this code should do the trick (you may need to check the name of your Hyperlink column, you may need to replace "URL" in the sample below with your column name:

    $web = get-spweb http://<SharePoint site URL>
    $list = $web.lists["<SharePoint List name>"]
    foreach ($item in $list.Items) {
            # Iterate HyperLink fields
            foreach ($field in $fields) {
                # Get field value
                $fldValue = $item["URL"]
                # Skip if null
                if($fldValue -ne $null) { 
                                      $item["URL"] = $fldValue -replace "http://server1", "http://server2"
                                      $item.update()
                }
            } 
    }

    If you're have access to your server, you might see if you can engage a SharePoint admin from your organization to help you test this out and run it in your farm. Or, if you're familiar with PowerShell, you can re-write this to use the Lists.asmx web service instead and update the field value via the web service from your client workstation.

    John


    MCITP and MCTS: SharePoint, Virtualization, Project Server 2007
    My books on Amazon: The SharePoint 2010 Disaster Recovery Guide and The SharePoint 2007 Disaster Recovery Guide.
    My blog: My Central Admin.

    Wednesday, May 30, 2012 7:47 PM

All replies

  • Hi,

    You mean to say Hyperlink Path is also a column right !.. then you can write a powershell script to read the list and take the column value and update the column with new values. 

    -

    Rao

    Wednesday, May 30, 2012 6:01 PM
  • Sorry, forgot to ask you one thing, do you have access to the sharepoint server? Then only PowerShell will help you...

    -

    Rao


    Wednesday, May 30, 2012 6:14 PM
  • I have to respectfully disagree with Rao's assertion that PowerShell will only help you with this issue if you have access to the SharePoint server. I would say instead that PowerShell can do it if you don't (by using the List.asmx web service rather than the Object Model), but that it will be much easier if you are able to run it on the server and take advantage of the SharePoint Object Model.

    If you can run it on the server, something similar to this code should do the trick (you may need to check the name of your Hyperlink column, you may need to replace "URL" in the sample below with your column name:

    $web = get-spweb http://<SharePoint site URL>
    $list = $web.lists["<SharePoint List name>"]
    foreach ($item in $list.Items) {
            # Iterate HyperLink fields
            foreach ($field in $fields) {
                # Get field value
                $fldValue = $item["URL"]
                # Skip if null
                if($fldValue -ne $null) { 
                                      $item["URL"] = $fldValue -replace "http://server1", "http://server2"
                                      $item.update()
                }
            } 
    }

    If you're have access to your server, you might see if you can engage a SharePoint admin from your organization to help you test this out and run it in your farm. Or, if you're familiar with PowerShell, you can re-write this to use the Lists.asmx web service instead and update the field value via the web service from your client workstation.

    John


    MCITP and MCTS: SharePoint, Virtualization, Project Server 2007
    My books on Amazon: The SharePoint 2010 Disaster Recovery Guide and The SharePoint 2007 Disaster Recovery Guide.
    My blog: My Central Admin.

    Wednesday, May 30, 2012 7:47 PM
  • Jhon is correct. As jhon said we can go for web service call. Instead of server side you can use client side script to call the web service (list.asmx). This can be done using jQuery and SPServices.

    -

    Rao

    Thursday, May 31, 2012 6:10 AM