We would like to get all hyperlinks within page content of each page(Sites Pages and Pages Library) in a site.

How to get all hyperlinks from page content in SharePoint 2010 using PowerShell or object model?

Is it possible? or we need to find all hyperlinks manually within content of the site. We would like to replace few hyperlinks with some different hyperlink.

1 Answer 1


I think you can't use PowerShell and Object Model to find links within a content page. it should be useful if it's Hyperlink columns within List. So I suggest to using Jquery / Javascript At content Editor web part at your Page.

To get all Links and update its URL via Javascript

window.onload = function() {
       /* onload code */

 var anchors = document.getElementsByClassName("the class of your links");
for (var i = 0; i < anchors.length; i++) {
    anchors[i].href = "http://www.example.com/?redirect=" + anchors[i].href

To update specific links using a Jquery

      this.href = this.href.replace("http://blog.devoworx.net");

The first part selects only links where the href starts with http://sharepoint.stackexchange

See also more details at How to change the href for a hyperlink using jQuery

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.