1

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

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

2 Answers 2

1

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
2
  • Thanks heapsI'll give it a go, pretty new to powershell so learning on the fly Commented Feb 18, 2016 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. Commented Feb 18, 2016 at 8:56
0

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.

1
  • Can you also post the way you are now getting the URLs, i.e. any script. Commented Jul 13, 2016 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.