0

I am running my code under administrative rights that iterates over different site->spweb to check the existance of a list. Strangely and for some site the code returns me that list does not exists(exception : List does not exists) Yet i can totally browse the list from browser on the same web what am i missing here ? EDIT:Adding Code

                    foreach (SPSite s in webApp.Sites)
                    {
                        foreach (SPWeb w in s.AllWebs)
                        {

                         try{
                          SPList sourceList = w.Lists["Ticks and  Cross"];
                          }catch(exception ex){ ..... }

                        }
                        s.Dispose();
                    }

All sites has same templates, so there is no chance that list is not ther. For some site i get the sourceList, for other its exception, its really wired

1 Answer 1

0

I guess you pass incorrect parameter to Lists[]. You should specify valid guid, title or index of the list. Can you post your code?

2
  • I wish, The list name has spaces thou, should i use %20 instead?
    – nomi
    Commented Feb 16, 2012 at 17:45
  • The list name looks OK - you can use spaces. But I don't see other option, if it fails name should be invalid. I would advise to make some debugging - can you examine Lists collection of the web inside catch (set breakpoint or add debug out put) to see which lists are there? Commented Feb 16, 2012 at 19:05

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.