I have a script going through all Web.Lists and List.Items in given site collection. On one point i want to have a full link to the item that is being processed. I'm doing it this way:
$ItemURL = $List.ParentWeb.Url + "/" + $List.RootFolder.Url + "/dispform.aspx?id=" + $Item.Id
It works on all lists, but not on libraries due to lacking /Forms/ after library name. Any idea how can i modify it to work also on libraries? Adding "/Forms/" strictly to the line of code will break link for lists.
string itemUrl = String.Format("{0}/{1}?ID={2}", properties.Web.Url, properties.List.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url, properties.ListItem.ID);
convert this to powershell – Arsalan Adam Khatri Oct 25 '17 at 9:04var fullUrl = item.ParentList.ParentWeb.Site.MakeFullUrl(item.ParentList.DefaultDisplayFormUrl) + "?ID=" + item.ID;
convert this to powershell – Arsalan Adam Khatri Oct 25 '17 at 9:25