예제 #1
0
        /// <summary>
        /// overwritten Query method
        /// </summary>
        /// <param name="feedQuery">The FeedQuery to use</param>
        /// <returns>the retrieved EmailListFeed</returns>
        public EmailListFeed Query(EmailListQuery feedQuery)
        {
            try
            {
                Stream feedStream = Query(feedQuery.Uri);
                EmailListFeed feed = new EmailListFeed(feedQuery.Uri, this);
                feed.Parse(feedStream, AlternativeFormat.Atom);
                feedStream.Close();

                if (feedQuery.RetrieveAllEmailLists)
                {
                    AtomLink next, prev = null;
                    while ((next = feed.Links.FindService("next", null)) != null && next != prev)
                    {
                        feedStream = Query(new Uri(next.HRef.ToString()));
                        feed.Parse(feedStream, AlternativeFormat.Atom);
                        feedStream.Close();

                        prev = next;
                    }
                }

                return feed;
            }
            catch (GDataRequestException e)
            {
                AppsException a = AppsException.ParseAppsException(e);
                throw (a == null ? e : a);
            }
        }
예제 #2
0
        /// <summary>
        /// Creates a new email list on this domain.
        /// </summary>
        /// <param name="emailList">the name of the email list that you wish to create.</param>
        /// <returns>the newly created EmailListEntry</returns>
        public EmailListEntry CreateEmailList(string emailList)
        {
            EmailListQuery query = new EmailListQuery(Domain);
            EmailListEntry entry = new EmailListEntry(emailList);

            return(emailListService.Insert(query.Uri, entry));
        }
        /// <summary>
        /// overwritten Query method
        /// </summary>
        /// <param name="feedQuery">The FeedQuery to use</param>
        /// <returns>the retrieved EmailListFeed</returns>
        public EmailListFeed Query(EmailListQuery feedQuery)
        {
            try
            {
                Stream        feedStream = Query(feedQuery.Uri);
                EmailListFeed feed       = new EmailListFeed(feedQuery.Uri, this);
                feed.Parse(feedStream, AlternativeFormat.Atom);
                feedStream.Close();

                if (feedQuery.RetrieveAllEmailLists)
                {
                    AtomLink next, prev = null;
                    while ((next = feed.Links.FindService("next", null)) != null && next != prev)
                    {
                        feedStream = Query(new Uri(next.HRef.ToString()));
                        feed.Parse(feedStream, AlternativeFormat.Atom);
                        feedStream.Close();

                        prev = next;
                    }
                }

                return(feed);
            }
            catch (GDataRequestException e)
            {
                AppsException a = AppsException.ParseAppsException(e);
                throw (a == null ? e : a);
            }
        }
예제 #4
0
        /// <summary>
        /// Deletes the specified email list.
        /// </summary>
        /// <param name="emailList">the name of the email list that you wish to delete</param>
        public void DeleteEmailList(string emailList)
        {
            EmailListQuery query = new EmailListQuery(Domain);

            query.EmailListName = emailList;

            emailListService.Delete(query.Uri);
        }
예제 #5
0
        /// <summary>
        /// Retrieves all email lists to which the specified user subscribes.
        /// </summary>
        /// <param name="recipient">the username or email address of a hosted user
        /// for which you wish to retrieve email list subscriptions</param>
        /// <returns>the feed containing all matching email list entries</returns>
        public EmailListFeed RetrieveEmailLists(string recipient)
        {
            EmailListQuery query = new EmailListQuery(Domain);

            query.Recipient = recipient;

            return(emailListService.Query(query));
        }
예제 #6
0
        /// <summary>
        /// Retrieves a page of at most 100 email list names beginning with the
        /// specified email list name.  Email lists are ordered case-insensitively
        /// by ASCII value.
        /// </summary>
        /// <param name="startEmailListName">the first email list name that should
        /// appear in your result set</param>
        /// <returns>the feed containing the matching email list entries</returns>
        public EmailListFeed RetrievePageOfEmailLists(string startEmailListName)
        {
            EmailListQuery query = new EmailListQuery(Domain);

            query.StartEmailListName    = startEmailListName;
            query.RetrieveAllEmailLists = false;

            return(emailListService.Query(query));
        }
예제 #7
0
        /// <summary>
        /// Retrieves the specified email list.
        /// </summary>
        /// <param name="emailList">is the name of the email list that you wish to retrieve</param>
        /// <returns>the resulting EmailListEntry</returns>
        public EmailListEntry RetrieveEmailList(string emailList)
        {
            EmailListQuery query = new EmailListQuery(Domain);

            query.EmailListName = emailList;

            EmailListFeed feed = emailListService.Query(query);

            // It's safe to access Entries[0] here, because the service will have
            // already thrown an exception if the email list name was invalid.
            return(feed.Entries[0] as EmailListEntry);
        }
예제 #8
0
        /// <summary>
        /// Deletes the specified email list.
        /// </summary>
        /// <param name="emailList">the name of the email list that you wish to delete</param>
        public void DeleteEmailList(string emailList)
        {
            EmailListQuery query = new EmailListQuery(Domain);
            query.EmailListName = emailList;

            emailListService.Delete(query.Uri);
        }
예제 #9
0
        /// <summary>
        /// Retrieves all email lists to which the specified user subscribes.
        /// </summary>
        /// <param name="recipient">the username or email address of a hosted user
        /// for which you wish to retrieve email list subscriptions</param>
        /// <returns>the feed containing all matching email list entries</returns>
        public EmailListFeed RetrieveEmailLists(string recipient)
        {
            EmailListQuery query = new EmailListQuery(Domain);
            query.Recipient = recipient;

            return emailListService.Query(query);
        }
예제 #10
0
        /// <summary>
        /// Retrieves the specified email list.
        /// </summary>
        /// <param name="emailList">is the name of the email list that you wish to retrieve</param>
        /// <returns>the resulting EmailListEntry</returns>
        public EmailListEntry RetrieveEmailList(string emailList)
        {
            EmailListQuery query = new EmailListQuery(Domain);
            query.EmailListName = emailList;

            EmailListFeed feed = emailListService.Query(query);

            // It's safe to access Entries[0] here, because the service will have
            // already thrown an exception if the email list name was invalid.
            return feed.Entries[0] as EmailListEntry;
        }
예제 #11
0
        /// <summary>
        /// Retrieves a page of at most 100 email list names beginning with the
        /// specified email list name.  Email lists are ordered case-insensitively
        /// by ASCII value.
        /// </summary>
        /// <param name="startEmailListName">the first email list name that should
        /// appear in your result set</param>
        /// <returns>the feed containing the matching email list entries</returns>
        public EmailListFeed RetrievePageOfEmailLists(string startEmailListName)
        {
            EmailListQuery query = new EmailListQuery(Domain);
            query.StartEmailListName = startEmailListName;
            query.RetrieveAllEmailLists = false;

            return emailListService.Query(query);
        }
예제 #12
0
        /// <summary>
        /// Retrieves all email lists on the domain.
        /// </summary>
        /// <returns>the feed containing all email list entries</returns>
        public EmailListFeed RetrieveAllEmailLists()
        {
            EmailListQuery query = new EmailListQuery(Domain);

            return emailListService.Query(query);
        }
예제 #13
0
        /// <summary>
        /// Creates a new email list on this domain.
        /// </summary>
        /// <param name="emailList">the name of the email list that you wish to create.</param>
        /// <returns>the newly created EmailListEntry</returns>
        public EmailListEntry CreateEmailList(string emailList)
        {
            EmailListQuery query = new EmailListQuery(Domain);
            EmailListEntry entry = new EmailListEntry(emailList);

            return emailListService.Insert(query.Uri, entry);
        }
 public void Init()
 {
     query = new EmailListQuery("example.com");
 }
예제 #15
0
        /// <summary>
        /// Retrieves all email lists on the domain.
        /// </summary>
        /// <returns>the feed containing all email list entries</returns>
        public EmailListFeed RetrieveAllEmailLists()
        {
            EmailListQuery query = new EmailListQuery(Domain);

            return(emailListService.Query(query));
        }