Find Sharepoint List Anyway

 public static SPList FindListAnyway(this SPWeb web, string listName, Guid ListId)
        {
            if (web == null)
            {
                return null;
            }
            SPList lst = null;

            try
            {
                lst = web.Lists.TryGetList(listName);
                if (lst == null)
                {
                    lst = web.Lists[ListId];
                }

            }
            catch
            {

                if (lst == null)
                {
                    foreach (SPList l in web.Lists)
                    {
                        if (string.Compare(l.Title, listName, true) == 0)
                        {
                            lst = l;
                            break;
                        }
                    }
                }

            }



            return lst;

        }
Example:
Guid _ListID = new Guid("AA953E63-FA0C-4546-B1AF-0AD816596A38");
SPList list = mySpWeb.FindListAnyway("PhoneBook", _ListID );

Description

this method find your list without any Exception by List Name , Title and ListID

Details

Double click on the code to select all.

 

;