{"id":188,"date":"2016-02-28T19:22:07","date_gmt":"2016-02-28T19:22:07","guid":{"rendered":"https:\/\/itgroove.net\/bangimportant\/?p=188"},"modified":"2023-02-24T21:39:36","modified_gmt":"2023-02-24T21:39:36","slug":"sharepoint-javascript-working-with-hyperlink-fields","status":"publish","type":"post","link":"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/","title":{"rendered":"SharePoint JavaScript Working with Hyperlink Fields"},"content":{"rendered":"\n<p>When using JSOM to retrieve SharePoint items (and their columns) getting a value is usually pretty straightforward. The following should look familiar:<\/p>\n\n\n\n<p>itemVariable.get_item(&#8216;abc&#8217;) where abc is the internal name of the column. (Remember the good old _x0020_ for spaces).<\/p>\n\n\n\n<p>But if you try to do the same on a Hyperlink column you will be returned an [object] instead of the value you were expecting. This is because these fields are indeed an object. They store multiple values. Mainly, the URL for the link and the text that needs to be displayed. So how do we get the values we need?<\/p>\n\n\n\n<p>If you inspect the object using a debugger you will see two methods to return the values. Assuming our column name is URL:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var urlObject = oListItem.get_item('URL');\n\nvar linkHref = urlObject.get_url()\n\nvar linkText = urlObject.get_description()<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When using JSOM to retrieve SharePoint items (and their columns) getting a value is usually pretty straightforward. The following should look familiar: itemVariable.get_item(&#8216;abc&#8217;) where abc is the internal name of the column. (Remember the good old _x0020_ for spaces). But if you try to do the same on a Hyperlink column you will be returned &hellip; <a href=\"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/\"><\/a><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[4,7],"tags":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SharePoint JavaScript Working with Hyperlink Fields - Archive<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SharePoint JavaScript Working with Hyperlink Fields - Archive\" \/>\n<meta property=\"og:description\" content=\"When using JSOM to retrieve SharePoint items (and their columns) getting a value is usually pretty straightforward. The following should look familiar: itemVariable.get_item(&#8216;abc&#8217;) where abc is the internal name of the column. (Remember the good old _x0020_ for spaces). But if you try to do the same on a Hyperlink column you will be returned &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/\" \/>\n<meta property=\"og:site_name\" content=\"Archive\" \/>\n<meta property=\"article:published_time\" content=\"2016-02-28T19:22:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-24T21:39:36+00:00\" \/>\n<meta name=\"author\" content=\"Colin Phillips (Alumni)\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Colin Phillips (Alumni)\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/\",\"url\":\"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/\",\"name\":\"SharePoint JavaScript Working with Hyperlink Fields - Archive\",\"isPartOf\":{\"@id\":\"https:\/\/regroove.ca\/archive\/#website\"},\"datePublished\":\"2016-02-28T19:22:07+00:00\",\"dateModified\":\"2023-02-24T21:39:36+00:00\",\"author\":{\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b\"},\"breadcrumb\":{\"@id\":\"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog Archive\",\"item\":\"https:\/\/regroove.ca\/archive\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SharePoint JavaScript Working with Hyperlink Fields\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/regroove.ca\/archive\/#website\",\"url\":\"https:\/\/regroove.ca\/archive\/\",\"name\":\"Archive\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/regroove.ca\/archive\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b\",\"name\":\"Colin Phillips (Alumni)\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g\",\"caption\":\"Colin Phillips (Alumni)\"},\"url\":\"https:\/\/regroove.ca\/archive\/author\/cphillips\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SharePoint JavaScript Working with Hyperlink Fields - Archive","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/","og_locale":"en_US","og_type":"article","og_title":"SharePoint JavaScript Working with Hyperlink Fields - Archive","og_description":"When using JSOM to retrieve SharePoint items (and their columns) getting a value is usually pretty straightforward. The following should look familiar: itemVariable.get_item(&#8216;abc&#8217;) where abc is the internal name of the column. (Remember the good old _x0020_ for spaces). But if you try to do the same on a Hyperlink column you will be returned &hellip;","og_url":"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/","og_site_name":"Archive","article_published_time":"2016-02-28T19:22:07+00:00","article_modified_time":"2023-02-24T21:39:36+00:00","author":"Colin Phillips (Alumni)","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Colin Phillips (Alumni)","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/","url":"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/","name":"SharePoint JavaScript Working with Hyperlink Fields - Archive","isPartOf":{"@id":"https:\/\/regroove.ca\/archive\/#website"},"datePublished":"2016-02-28T19:22:07+00:00","dateModified":"2023-02-24T21:39:36+00:00","author":{"@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b"},"breadcrumb":{"@id":"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/regroove.ca\/archive\/2016\/02\/28\/sharepoint-javascript-working-with-hyperlink-fields\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Archive","item":"https:\/\/regroove.ca\/archive\/"},{"@type":"ListItem","position":2,"name":"SharePoint JavaScript Working with Hyperlink Fields"}]},{"@type":"WebSite","@id":"https:\/\/regroove.ca\/archive\/#website","url":"https:\/\/regroove.ca\/archive\/","name":"Archive","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/regroove.ca\/archive\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b","name":"Colin Phillips (Alumni)","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g","caption":"Colin Phillips (Alumni)"},"url":"https:\/\/regroove.ca\/archive\/author\/cphillips\/"}]}},"_links":{"self":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/188"}],"collection":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/comments?post=188"}],"version-history":[{"count":1,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":1823,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/188\/revisions\/1823"}],"wp:attachment":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/media?parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/categories?post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/tags?post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}