I need to pass SPWeb an SPList as function parameters:

string check(SPWeb web1, SPList splist1){}

Yet, web1.Title, splist1.Title throws errors:

There is no Web named "/http://DevSite".

Is there another way to get this variables? by passing as a reference?

  • 1
    how are you creating SPWeb object? Its seems problem with the way you are initializing these objects. May 27, 2015 at 15:06
  • yes ! you are right! The error was at the calling function !!
    – XristosK
    May 27, 2015 at 15:21

1 Answer 1


The error was in the calling function. Before:

using (SPWeb web11 = spsite.OpenWeb(webURL))
      if (web11 != null)
            spweb = web11; <-- error
            splist = spweb.GetList(paramwebURL);
return check(spweb,sptitle);

The correct is : spweb = spsite.OpenWeb(webURL); For (unknown to me) reason, assignment between SPWeb's didn't worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.