Based on several posts and other entries on the Forum, I am running into issues.
I am tasked with writing a SharePoint 2010 timer job that will loop through a list of absolute URLs to various objects within the site and see which, if any, have been removed.
So I start with the full URL to the object (mostly ASPX and PDFs) and expect to be able to get the site and web to get to the list object via the absolute URL, however this is failing.
chckFavURL = "https://hostheader.com/subsite1/subsite2/subsite3/library/My Page.aspx"; using (SPSite favSite = new SPSite(chckFavURL)) { using (SPWeb favWeb = favSite.OpenWeb(chckFavURL)) { SPListItem favorite = favWeb.GetListItem(chckFavURL); } }
The favSite is not the subsite3 as expected, rather is the root site. I've tried OpenWeb and not passing in the absolute URL with the same results, and of course, because favSite is the root site, the SPListItem is failing because the ASPX is not on the roote site.
Can anyone advise where I'm misstepping?
- Thank you. Respectfully, Janette M. Ricker