Get current URL and put into SharePoint Online column

Rob Smith 1 Reputation point
2020-09-01T08:36:09.417+00:00

As per title really, is there a way to get the current browsed URL and put automatically into SharePoint Online column? This is on the NewItem.aspx page. I need to get the full URL (including a ?ID= bit on the end)

Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Murugesa Pandian 86 Reputation points
    2020-09-01T17:22:08.77+00:00

    Hi var CurrentUrl = _spPageContextInfo.siteServerRelativeUrl
    try to add this line into your page's header and log the variable CurrentUrl. or window.location and parse the query string to get specific parameter

    0 comments No comments

  2. Baker Kong-MSFT 3,801 Reputation points
    2020-09-02T01:28:57.447+00:00

    Hi RobSmith-5452,

    You can use 'window.location.href' to get the entire URL of the current page.

    Check https://www.tutorialrepublic.com/javascript-tutorial/javascript-window-location.php

    Thanks
    Baker Kong


    If the response is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.