Wednesday, January 6, 2016

FileNotFoundException :0x80070002

Don’t do like this:

SPSecurity.RunWithElevatedPrivileges(delegate() {

using (SPSite site = new SPSite(SPContext.Current.Web.Url))

{    using (SPWeb web = site.OpenWeb())

    {

        SPList list = web.Lists["List"];

        foreach (SPListItem item in itemCollections)

        {  

  SPWeb surveyWeb = site.OpenWeb(ServerRelativeurl);

}

}

}

});

 

To be change :

SPList list = web.GetList("/WebName/Lists/listName");

 

Or you can use following code:

 

SPList list = web.Lists["listName"];

 

 

No comments:

Post a Comment