Ejemplo n.º 1
0
        public IEnumerable <ListInfo> GetLists(ListContainerInfo container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            Func <ListInfo, bool> filter;

            if (container == container.Web)
            {
                // Lists placed directly on the web have their relative path equal to their name
                // which means that it contains no slash. Because the SharePoint object model
                // returns only all lists on a web regardless in what web folder they are we have
                // to filter them.
                filter = list => !list.WebRelativePath.Contains('/');
            }
            else
            {
                // Lists placed not directly on the web must have their relative path concatenated
                // from their parent web folder name and their actual list name which means that
                // it must start with the web folder name and slash. Because the SharePoint object
                // model returns only all lists on a web regardless in what web folder they are we
                // have to filter them.
                var start = container.Name + "/";
                filter = list => list.WebRelativePath.StartsWithCI(start);
            }
            return(GetAllLists(container.Web).Where(filter).ToList());
        }
Ejemplo n.º 2
0
 public IEnumerable<ListInfo> GetLists(ListContainerInfo container)
 {
     if (container == null)
         throw new ArgumentNullException("container");
     Func<ListInfo, bool> filter;
     if (container == container.Web) {
         // Lists placed directly on the web have their relative path equal to their name
         // which means that it contains no slash. Because the SharePoint object model
         // returns only all lists on a web regardless in what web folder they are we have
         // to filter them.
         filter = list => !list.WebRelativePath.Contains('/');
     } else {
         // Lists placed not directly on the web must have their relative path concatenated
         // from their parent web folder name and their actual list name which means that
         // it must start with the web folder name and slash. Because the SharePoint object
         // model returns only all lists on a web regardless in what web folder they are we
         // have to filter them.
         var start = container.Name + "/";
         filter = list => list.WebRelativePath.StartsWithCI(start);
     }
     return GetAllLists(container.Web).Where(filter).ToList();
 }