I need to extract the full URL for a 'task' in a 'task list' via a PowerShell script.

My goal here is to extract this URL, report on it and the end user can click on the URL and it would take him directly to the Task in question.

Environment - SharePoint Enterpeise 2013

Thanks all

  • You want to generate a kind of Excel/csv file from PowerShell, and then distribute that file to end-users, correct? – Evariste Feb 18 '16 at 6:45
  • What mode of the task you want your users to land at? DispForm (read) or EditForm (modify)? – Aziz Kabyshev Feb 18 '16 at 9:26

Getting the URL of an item in PowerShell is quite simple:

$web = get-SPWeb <SiteURL>
$list = $web.GetList("<AbsoluteURL_Of_The_List>") # or <Server-RelativeURL_Of_The_List>
$item = $list.GetItemById(<ItemId>)
$taskUrl = $item.URL
  • Thanks heapsI'll give it a go, pretty new to powershell so learning on the fly – JohnDa Feb 18 '16 at 7:53
  • @arax28 suggested an edit on this answer to change <AbsoluteURL_Of_The_List> to <RelativeFromRoot_URL_Of_The_List>. I rejected it since "RelativeFromRoot" is not clear enough to me: root of what? GetList needs a complete URL. I generally use the absolute URL (by combining the SPWeb.Url with the list site-relative URL) but it is true that you can use th server-relative URL of the list instead (by combining SPWeb.ServerRelativeUrl and the list site-relative URL). I could have improved the suggestion made by @arax28, but actually I rejected it a bit too quickly, sorry for that. – Evariste Feb 18 '16 at 8:56

Ok so in basic terms. you are not able to retrieve with the ID, so what I have done is to lock down the URL so that the users cannot change it with a bit of j-query (not with permissions). So now I can safely take the original title from sharepoint and use it to build the url, I can now get the URL.

  • Can you also post the way you are now getting the URLs, i.e. any script. – Asad Refai Jul 13 '16 at 5:34

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.