Wednesday, October 2, 2013

FileNotFoundException on SPWeb.GetList

  • You are writing code using the server object model and encounter an intermittant FileNotFound error when using the GetList command after using New Site and OpenWeb(FullURL), passing in a subsite url to OpenWeb. Note that if you add in a delay between OpenWeb and GetList the error does not occur.
  • Apparently Opening the web at a specific location causes the GetList function to behave inconsistantly, throwing a File Not Found exception. Note that we only tried this on SharePoint 2010 in a Visual Studio 2010 console application. This may have been an environment specific issue, so if this solved your problem also, please comment if the environment was the same or different.
  • Pass the web url into the SPSite constructor and call GetWeb with no parameters. Then, when you call SPWeb.GetList(FullUrl) you will not get the FileNotFound exception.

1 comment:

  1. The same problem in sharepoint 2013 and visual studio 2013 in popup dialog