Question

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

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top