I'm using SharePoint CSOM 2013 SDK.
I'm having trouble getting a ListItem's URL reliably.
I have a list item that has the URL:
http://sphome/Lists/davidslist/DispForm.aspx?ID=1&Source=http%3A%2F%2Fsphome%2FLists%2Fdavidslist%2FAllItems%2Easpx&ContentTypeId=0x010088B3C2188A70AB4388B47EAC6D8EC48F
Here is what I got so far but it just doesn't seem right.
if (listItem.File.ServerObjectIsNull == false)
{
itemDict.Add("Url", site + listItem.File.ServerRelativeUrl);
}
else if (listItem.Folder.ServerObjectIsNull == false)
{
itemDict.Add("Url", site + listItem.Folder.ServerRelativeUrl);
}
else
{
itemDict.Add("Url", site + listItem["FileDirRef"].ToString());
}How do I get the List Item URL correctly and generically?
Shouldn't there be some URL field or something?
I did find this post but the answer seems wrong.