示例#1
0
        /// <summary>
        /// Get all Non Hidden Views that belong to a List
        /// </summary>
        /// <param name="selectedListGuid">GUID of the selected list in the tree view</param>
        /// <returns></returns>
        public List <SharePointItem> GetSharepointViewCollection(string selectedListGuid)
        {
            _viewsWS.Url = _selectedSiteUrl + "/_vti_bin/Views.asmx";
            List <SharePointItem> viewCollection = new List <SharePointItem>();
            XElement allViewElements             = XElement.Parse(_viewsWS.GetViewCollection(selectedListGuid).OuterXml);
            IEnumerable <XElement> viewElements  = from view in allViewElements.Elements()
                                                   where view.Attributes("Hidden").Any() == false
                                                   select view;

            foreach (XElement element in viewElements)
            {
                SharePointItem view = new SharePointItem();
                view.Guid  = element.Attribute("Name").Value;
                view.Title = element.Attribute("DisplayName").Value;
                viewCollection.Add(view);
            }
            return(viewCollection);
        }
示例#2
0
        /// <summary>
        /// Get all List items that are of the specified List Type
        /// </summary>
        /// <param name="listType">TemplateId of the requried List Type</param>
        /// <returns>Collection of list items belonging to the specified list type</returns>
        public List <SharePointItem> GetListCollection(string listType)
        {
            _listWS.Url = _selectedSiteUrl + "_vti_bin/lists.asmx";
            List <SharePointItem> listCollection = new List <SharePointItem>();
            XElement listCollectionNode          = XElement.Parse(_listWS.GetListCollection().OuterXml);

            IEnumerable <XElement> listTypeItems = from listItem in listCollectionNode.Elements()
                                                   where listItem.Attribute("ServerTemplate").Value == listType
                                                   select listItem;


            foreach (XElement element in listTypeItems)
            {
                SharePointItem list = new SharePointItem();
                list.Guid  = element.Attribute("ID").Value;
                list.Title = element.Attribute("Title").Value;
                listCollection.Add(list);
            }
            return(listCollection);
        }
        /// <summary>
        /// Get all Non Hidden Views that belong to a List
        /// </summary>
        /// <param name="selectedListGuid">GUID of the selected list in the tree view</param>
        /// <returns></returns>
        public List<SharePointItem> GetSharepointViewCollection(string selectedListGuid)
        {
            _viewsWS.Url = _selectedSiteUrl + "/_vti_bin/Views.asmx";
            List<SharePointItem> viewCollection = new List<SharePointItem>();
            XElement allViewElements = XElement.Parse(_viewsWS.GetViewCollection(selectedListGuid).OuterXml);
            IEnumerable<XElement> viewElements = from view in allViewElements.Elements()
                                                 where view.Attributes("Hidden").Any() == false
                                                 select view;

            foreach (XElement element in viewElements)
            {
                SharePointItem view = new SharePointItem();
                view.Guid = element.Attribute("Name").Value;
                view.Title = element.Attribute("DisplayName").Value;
                viewCollection.Add(view);
            }
            return viewCollection;
        }
        /// <summary>
        /// Get all List items that are of the specified List Type 
        /// </summary>
        /// <param name="listType">TemplateId of the requried List Type</param>
        /// <returns>Collection of list items belonging to the specified list type</returns>
        public List<SharePointItem> GetListCollection(string listType)
        {
            _listWS.Url = _selectedSiteUrl + "_vti_bin/lists.asmx";
            List<SharePointItem> listCollection = new List<SharePointItem>();
            XElement listCollectionNode = XElement.Parse(_listWS.GetListCollection().OuterXml);

            IEnumerable<XElement> listTypeItems = from listItem in listCollectionNode.Elements()
                                                  where listItem.Attribute("ServerTemplate").Value == listType
                                                  select listItem;

            foreach (XElement element in listTypeItems)
            {
                SharePointItem list = new SharePointItem();
                list.Guid = element.Attribute("ID").Value;
                list.Title = element.Attribute("Title").Value;
                listCollection.Add(list);
            }
            return listCollection;
        }