We have a website that looks up some text from a SharePoint list and displays it on the site. In the list, the text is a rich text format and the URL is added as a hyperlink. Sometimes the hyperlink is to a page or resource on our SharePoint site. In this case, the entire URL is in the text: example of text showing hyperlinks embedded

If I go back later and edit the text, the full URL is in the field as far as I can tell.

When we query the announcements list we are doing so via a REST api call to the following URL:

https://[ourdomain].sharepoint.com/sites/[oursite]/_api/web/lists/GetByTitle('Announcements')/GetItems(query=@v1)?@v1={"ViewXml":"<View><Query><Where><And><Eq><FieldRef Name='Display_x0020_on_x0020_WebApp' /><Value Type='Boolean'>1</Value></Eq><And><Leq><FieldRef Name='Display_x0020_From' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2020-08-12T05:39:19</Value></Leq><Or><IsNull><FieldRef Name='Display_x0020_To' /></IsNull><Geq><FieldRef Name='Display_x0020_To' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2020-08-12T05:39:19</Value></Geq></Or></And></And></Where><OrderBy><FieldRef Name='Priority' Ascending='True' /></OrderBy></Query></View>"}

When the Announcement text is returned, the embedded hyperlinks that refer to our own sharepoint site are changed automatically into relative links (i.e. the part of the URL https://[ourdomain].sharepoint.com/ is removed from the link) but since the links are displayed on a different website, they no longer work.

How can we stop SharePoint from changing the URL to a relative one with the API call?

I was investigating using the SPRenderListDataOptions DisableAutoHyperlink option, but it didn't seem to do anything, or I wasn't using it right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.