I have used GetListItem in SP2010 solutions and had no problem with it. In a new website in SP2013 it is now failing to find the list item. On a page with a summary links field I am running through the URLs and wanting to check to see if the SPListItem.HasPublishedVersion to know whether it should be displayed on the anonymous Internet zone site. It fails every time. I have tried both sending a relative URL and an absolute URL. Neither works. The only other difference with this site is that we are using the new SP2013 managed metadata navigation, if that makes any difference. The URLs that I pass in to GetListItem are all valid and I can load them in the browser.
Any ideas?
Here's my code:
I have tried both the full absolute URL and the relative URL
string itemUrl = SPUtility.ConcatUrls(rootWeb.Url, linkVal.LinkUrl); //itemUrl = "/subsite/pages/testpage.aspx"; SPListItem linkedItem = SPContext.Current.Web.GetListItem(itemUrl); object o = rootWeb.GetFileOrFolderObject(itemUrl);