Example #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);
            }
        }
        /// <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);
            }
        }
Example #3
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);
        }
 /// <summary>
 /// Inserts a new email list entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public EmailListEntry Insert(EmailListFeed feed, EmailListEntry entry)
 {
     try
     {
         return(base.Insert(feed, entry) as EmailListEntry);
     }
     catch (GDataRequestException e)
     {
         AppsException a = AppsException.ParseAppsException(e);
         throw (a == null ? e : a);
     }
 }
Example #5
0
 /// <summary>
 /// Inserts a new email list entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public EmailListEntry Insert(EmailListFeed feed, EmailListEntry entry)
 {
     try
     {
         return base.Insert(feed, entry) as EmailListEntry;
     }
     catch (GDataRequestException e)
     {
         AppsException a = AppsException.ParseAppsException(e);
         throw (a == null ? e : a);
     }
 }