Hi, I have a strange issue that my Site collection was installed root such as http://sp13server:7071 and have a SharePointLibrary list. Its been working in SP2010 without any issues more than year. I wanted to run this in 2013 environment and initially deployed WSP then it failed to run the timer job with the same issue. I then upgraded the Time solution to support SharePoint 2013. Build and deployment works successfully. During runtime here is how it throws error during debug (contentDb.Sites[0].RootWeb.Lists)
public override void Execute(Guid targetInstanceId)
{
SPWebApplication webapp = this.Parent as SPWebApplication;
SPContentDatabase contentDb = webapp.ContentDatabases[targetInstanceId];
SPList DocLib = contentDb.Sites[0].RootWeb.Lists["SharePointLibrary"]; // Error throws here.
//Alternative I tried below
using (SPSite site = contentDb.Sites[0]) /Error throws here
{
using (SPWeb web = site.OpenWeb())
{
SPList DocLib = web.Lists["SharePointLibrary"];
}
}
}
Any advise to change for SP13 is greatly appreciated.
Thanks
Shri