Example #1
0
        public ForumUser GetLast()
        {
            SharePointListProvider   provider   = new SharePointListProvider(ForumApplication.Instance.SpWeb);
            SharePointListDescriptor descriptor = provider.GetAllListItems(ForumConstants.Lists_Users);
            SharePointListItem       item       = descriptor.SharePointListItems[descriptor.SharePointListItems.Length - 1];

            return(UserMapper.CreateDomainObject(item));
        }
Example #2
0
        public SharePointListDescriptor GetListById(Guid guid)
        {
            this.web.Lists.IncludeRootFolder = true;
            SharePointListDescriptor descriptor = new SharePointListDescriptor();
            SPList list = this.GetList(guid.ToString());

            descriptor.ListId   = list.ID.ToString();
            descriptor.ListName = list.Title;
            return(descriptor);
        }
Example #3
0
        public IList <Message> GetByTopicId(int id)
        {
            IList <Message>          messages  = new List <Message>();
            SharePointListDescriptor postItems = Provider.GetListItemsByField(ForumConstants.Lists_Posts, "TopicID", id.ToString());

            foreach (SharePointListItem postItem in postItems.SharePointListItems)
            {
                messages.Add(MessageMapper.CreateDomainObject(postItem));
            }
            return(messages);
        }
Example #4
0
        /// <summary>
        /// Gets all.
        /// </summary>
        /// <returns></returns>
        public IList <Message> GetAll()
        {
            IList <Message>          messages  = new List <Message>();
            SharePointListDescriptor postItems = Provider.GetAllListItems(ForumConstants.Lists_Posts);

            foreach (SharePointListItem postItem in postItems.SharePointListItems)
            {
                messages.Add(MessageMapper.CreateDomainObject(postItem));
            }
            return(messages);
        }
Example #5
0
        /// <summary>
        /// Gets all categories.
        /// </summary>
        /// <returns></returns>
        public IList <Category> GetAll()
        {
            SharePointListDescriptor items = Provider.GetAllListItems(ForumConstants.Lists_Category);

            IList <Category> categoryCollection = new List <Category>();

            foreach (SharePointListItem listItem in items.SharePointListItems)
            {
                categoryCollection.Add(CategoryMapper.CreateDomainObject(listItem));
            }
            return(categoryCollection);
        }
Example #6
0
        public IList <Forum> FindByCategoryId(int id)
        {
            SharePointListDescriptor descriptor      = Provider.GetListItemsByField(ForumConstants.Lists_Forums, "CategoryID", id.ToString());
            IList <Forum>            forumCollection = new List <Forum>();

            foreach (SharePointListItem listItem in descriptor.SharePointListItems)
            {
                forumCollection.Add(ForumMapper.CreateDomainObject(listItem));
            }

            return(forumCollection);
        }
Example #7
0
        public IList <Topic> FindByDate(DateTime dateCriteria)
        {
            string isoDate = SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateCriteria);
            SharePointListDescriptor listItems = Provider.GetListItemsByField(ForumConstants.Lists_Topics, "Modified", isoDate);
            IList <Topic>            topics    = new List <Topic>();

            foreach (SharePointListItem item in listItems.SharePointListItems)
            {
                topics.Add(TopicMapper.CreateDomainObject(item));
            }
            return(topics);
        }
Example #8
0
        public IList <Topic> FindInactive()
        {
            SharePointListDescriptor listItems = Provider.GetListItemsByField(
                ForumConstants.Lists_Topics, "NumPosts", "1");
            IList <Topic> topics = new List <Topic>();

            foreach (SharePointListItem item in listItems.SharePointListItems)
            {
                topics.Add(TopicMapper.CreateDomainObject(item));
            }
            return(topics);
        }
Example #9
0
        public Hashtable GetPermissionsForForum(int id)
        {
            Hashtable permissions = new Hashtable();
            SharePointListDescriptor listItems = Provider.GetListItemsByField(ForumConstants.Lists_ForumAccess, "ForumID", id.ToString());

            foreach (SharePointListItem listItem in listItems.SharePointListItems)
            {
                Permission perm = new Permission(listItem["Title"]);
                permissions.Add(Convert.ToInt32(listItem["GroupID"]), perm);
            }
            return(permissions);
        }
Example #10
0
        public IList <Forum> GetAll()
        {
            SharePointListDescriptor descriptor      = Provider.GetAllListItems(ForumConstants.Lists_Forums);
            IList <Forum>            forumCollection = new List <Forum>();

            foreach (SharePointListItem listItem in descriptor.SharePointListItems)
            {
                forumCollection.Add(ForumMapper.CreateDomainObject(listItem));
            }

            return(forumCollection);
        }
Example #11
0
        public IList <Group> GetAll()
        {
            IList <Group>            groups   = new List <Group>();
            SharePointListProvider   provider = new SharePointListProvider(ForumApplication.Instance.SpWeb);
            SharePointListDescriptor items    = provider.GetAllListItems(ForumConstants.Lists_Groups);

            foreach (SharePointListItem listItem in items.SharePointListItems)
            {
                groups.Add(new Group(listItem.Id, listItem["Title"]));
            }

            return(groups);
        }
Example #12
0
 public SharePointListDescriptor[] GetLists()
 {
     this.web.Lists.IncludeRootFolder = true;
     SharePointListDescriptor[] descriptorArray = new SharePointListDescriptor[this.web.Lists.Count];
     for (int i = 0; i < descriptorArray.Length; i++)
     {
         descriptorArray[i]                     = new SharePointListDescriptor();
         descriptorArray[i].ListId              = this.web.Lists[i].ID.ToString();
         descriptorArray[i].ListName            = this.web.Lists[i].Title;
         descriptorArray[i].SharePointListItems = null;
     }
     return(descriptorArray);
 }
Example #13
0
        public IList <Topic> GetAll()
        {
            IList <Topic> topicCollection = new List <Topic>();

            SharePointListDescriptor descriptor = Provider.GetAllListItems(ForumConstants.Lists_Topics);

            foreach (SharePointListItem listItem in descriptor.SharePointListItems)
            {
                topicCollection.Add(TopicMapper.CreateDomainObject(listItem));
            }

            return(topicCollection);
        }
Example #14
0
        public IList <Topic> FindByForumId(int id)
        {
            IList <Topic> topicCollection = new List <Topic>();

            SharePointListDescriptor descriptor = Provider.GetListItemsByField(ForumConstants.Lists_Topics, "ForumID", id.ToString());

            foreach (SharePointListItem listItem in descriptor.SharePointListItems)
            {
                topicCollection.Add(TopicMapper.CreateDomainObject(listItem));
            }

            return(topicCollection);
        }
Example #15
0
        public IList <ForumUser> GetAll()
        {
            IList <ForumUser> users = new List <ForumUser>();

            SharePointListProvider   provider   = new SharePointListProvider(ForumApplication.Instance.SpWeb);
            SharePointListDescriptor descriptor = provider.GetAllListItems(ForumConstants.Lists_Users);

            foreach (SharePointListItem listItem in descriptor.SharePointListItems)
            {
                users.Add(UserMapper.CreateDomainObject(listItem));
            }

            return(users);
        }
Example #16
0
        public SharePointListDescriptor GetListItemsByField(string listName, string fieldNames, string fieldValues, string queryType)
        {
            SPList  spList = this.GetList(listName);
            SPQuery query  = new SPQuery();

            query.Query = "<Where>" + this.GetCAMLClause(spList, fieldNames, fieldValues, queryType) + "</Where>";
            SPListItemCollection     items      = spList.GetItems(query);
            SharePointListDescriptor descriptor = new SharePointListDescriptor();

            descriptor.ListId = spList.ID.ToString();
            descriptor.SharePointListItems = new SharePointListItem[items.Count];
            descriptor.ListName            = spList.Title;
            for (int i = 0; i < items.Count; i++)
            {
                descriptor.SharePointListItems[i] = this.SPListItemtoDescriptor(items[i]);
            }
            return(descriptor);
        }
Example #17
0
 public SharePointListDescriptor GetAllListItems(string listName)
 {
     try
     {
         SPList list = this.GetList(listName);
         SharePointListDescriptor descriptor = new SharePointListDescriptor();
         descriptor.ListId              = list.ID.ToString();
         descriptor.ListName            = list.Title;
         descriptor.SharePointListItems = new SharePointListItem[list.ItemCount];
         for (int i = 0; i < list.ItemCount; i++)
         {
             descriptor.SharePointListItems[i] = this.SPListItemtoDescriptor(list.Items[i]);
         }
         return(descriptor);
     }
     catch (Exception)
     {
         return(new SharePointListDescriptor());
     }
 }
 public SharePointListDescriptor GetAllListItems(string listName)
 {
     try
     {
         SPList list = this.GetList(listName);
         SharePointListDescriptor descriptor = new SharePointListDescriptor();
         descriptor.ListId = list.ID.ToString();
         descriptor.ListName = list.Title;
         descriptor.SharePointListItems = new SharePointListItem[list.ItemCount];
         for (int i = 0; i < list.ItemCount; i++)
         {
             descriptor.SharePointListItems[i] = this.SPListItemtoDescriptor(list.Items[i]);
         }
         return descriptor;
     }
     catch (Exception)
     {
         return new SharePointListDescriptor();
     }
 }
Example #19
0
        public SharePointListDescriptor GetListItemsByField(string listName, string[] fieldNames, string[] fieldValues)
        {
            SPList spList = this.GetList(listName);
            string str    = "";

            if (fieldNames.Length != fieldValues.Length)
            {
                throw new Exception("# of values must match # of fields");
            }
            for (int i = 0; i < fieldNames.Length; i++)
            {
                string str2 = this.GetCAMLClause(spList, fieldNames[i], fieldValues[i]);
                if (str.Length > 0)
                {
                    str = "<And>" + str + str2 + "</And>";
                }
                else
                {
                    str = str2;
                }
            }
            SPQuery query = new SPQuery();

            query.Query = "<Where>" + str + "</Where>";
            SPListItemCollection     items      = spList.GetItems(query);
            SharePointListDescriptor descriptor = new SharePointListDescriptor();

            descriptor.ListId = spList.ID.ToString();
            descriptor.SharePointListItems = new SharePointListItem[items.Count];
            descriptor.ListName            = spList.Title;
            for (int j = 0; j < items.Count; j++)
            {
                descriptor.SharePointListItems[j] = this.SPListItemtoDescriptor(items[j]);
            }
            return(descriptor);
        }
 public SharePointListDescriptor[] GetLists()
 {
     this.web.Lists.IncludeRootFolder = true;
     SharePointListDescriptor[] descriptorArray = new SharePointListDescriptor[this.web.Lists.Count];
     for (int i = 0; i < descriptorArray.Length; i++)
     {
         descriptorArray[i] = new SharePointListDescriptor();
         descriptorArray[i].ListId = this.web.Lists[i].ID.ToString();
         descriptorArray[i].ListName = this.web.Lists[i].Title;
         descriptorArray[i].SharePointListItems = null;
     }
     return descriptorArray;
 }
 public SharePointListDescriptor GetListById(Guid guid)
 {
     this.web.Lists.IncludeRootFolder = true;
     SharePointListDescriptor descriptor = new SharePointListDescriptor();
     SPList list = this.GetList(guid.ToString());
     descriptor.ListId = list.ID.ToString();
     descriptor.ListName = list.Title;
     return descriptor;
 }
 public SharePointListDescriptor GetListItemsByField(string listName, string[] fieldNames, string[] fieldValues)
 {
     SPList spList = this.GetList(listName);
     string str = "";
     if (fieldNames.Length != fieldValues.Length)
     {
         throw new Exception("# of values must match # of fields");
     }
     for (int i = 0; i < fieldNames.Length; i++)
     {
         string str2 = this.GetCAMLClause(spList, fieldNames[i], fieldValues[i]);
         if (str.Length > 0)
         {
             str = "<And>" + str + str2 + "</And>";
         }
         else
         {
             str = str2;
         }
     }
     SPQuery query = new SPQuery();
     query.Query = "<Where>" + str + "</Where>";
     SPListItemCollection items = spList.GetItems(query);
     SharePointListDescriptor descriptor = new SharePointListDescriptor();
     descriptor.ListId = spList.ID.ToString();
     descriptor.SharePointListItems = new SharePointListItem[items.Count];
     descriptor.ListName = spList.Title;
     for (int j = 0; j < items.Count; j++)
     {
         descriptor.SharePointListItems[j] = this.SPListItemtoDescriptor(items[j]);
     }
     return descriptor;
 }
 public SharePointListDescriptor GetListItemsByField(string listName, string fieldNames, string fieldValues, string queryType)
 {
     SPList spList = this.GetList(listName);
     SPQuery query = new SPQuery();
     query.Query = "<Where>" + this.GetCAMLClause(spList, fieldNames, fieldValues, queryType) + "</Where>";
     SPListItemCollection items = spList.GetItems(query);
     SharePointListDescriptor descriptor = new SharePointListDescriptor();
     descriptor.ListId = spList.ID.ToString();
     descriptor.SharePointListItems = new SharePointListItem[items.Count];
     descriptor.ListName = spList.Title;
     for (int i = 0; i < items.Count; i++)
     {
         descriptor.SharePointListItems[i] = this.SPListItemtoDescriptor(items[i]);
     }
     return descriptor;
 }