If you ever wanted to develope a ms SharePoint v3 web part, which should use an exsting view, or the default view, to filter the list items, then you have certainly also stated that the return values are not correct in some places.
Whenever your Web part and a list view web part of the same sp list, lives side by side on the same sp site your return are a little bit scrappy..

from msdn:

  • SPWeb sPWebContext = SPControl.GetContextWeb(HttpContext.Current);
                       

here is the solution:

  • SPWeb sPWebContext = null;
  • SPSecurity.RunWithElevatedPrivileges(delegate(){sPWebContext = (new SPSite(SPControl.GetContextWeb(HttpContext.Current).Url) ).AllWebs[SPControl.GetContextWeb(HttpContext.Current).ID];});

Comments


Comments are closed