Exemple #1
0
        /// <summary>
        /// Adds the specified recipient to an email list.
        /// </summary>
        /// <param name="recipientAddress">the email address that is being added</param>
        /// <param name="emailList">the email address to which the address is being added</param>
        /// <returns>the newly inserted EmailListRecipientEntry</returns>
        public EmailListRecipientEntry AddRecipientToEmailList(string recipientAddress, string emailList)
        {
            EmailListRecipientQuery query = new EmailListRecipientQuery(Domain, emailList);
            EmailListRecipientEntry entry = new EmailListRecipientEntry(recipientAddress);

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

                if (feedQuery.RetrieveAllRecipients)
                {
                    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);
            }
        }
Exemple #3
0
        /// <summary>
        /// overwritten Query method
        /// </summary>
        /// <param name="feedQuery">The FeedQuery to use</param>
        /// <returns>the retrieved EmailListRecipientFeed</returns>
        public EmailListRecipientFeed Query(EmailListRecipientQuery feedQuery)
        {
            try
            {
                Stream feedStream           = Query(feedQuery.Uri);
                EmailListRecipientFeed feed = new EmailListRecipientFeed(feedQuery.Uri, this);
                feed.Parse(feedStream, AlternativeFormat.Atom);
                feedStream.Close();

                if (feedQuery.RetrieveAllRecipients)
                {
                    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);
            }
        }
Exemple #4
0
        /// <summary>
        /// Removes the specified recipient from an email list.
        /// </summary>
        /// <param name="recipientAddress">the email address that is being removed</param>
        /// <param name="emailList">the email address from which the address is being removed</param>
        public void RemoveRecipientFromEmailList(string recipientAddress, string emailList)
        {
            EmailListRecipientQuery query = new EmailListRecipientQuery(Domain, emailList);

            query.Recipient = recipientAddress;

            emailListRecipientService.Delete(query.Uri);
        }
Exemple #5
0
        /// <summary>
        /// Retrieves a page of at most 100 subscribers to an email list.
        /// Email addresses are ordered case-insensitively by ASCII value.
        /// </summary>
        /// <param name="emailList">the name of the email list for which you
        /// are retrieving recipients</param>
        /// <param name="startRecipient">the first email address that should
        /// appear in your result set</param>
        /// <returns>a feed containing the matching subscribers</returns>
        public EmailListRecipientFeed RetrievePageOfRecipients(string emailList, string startRecipient)
        {
            EmailListRecipientQuery query = new EmailListRecipientQuery(Domain, emailList);

            query.StartRecipient = startRecipient;

            return(emailListRecipientService.Query(query));
        }
        /// <summary>
        /// Removes the specified recipient from an email list.
        /// </summary>
        /// <param name="recipientAddress">the email address that is being removed</param>
        /// <param name="emailList">the email address from which the address is being removed</param>
        public void RemoveRecipientFromEmailList(string recipientAddress, string emailList)
        {
            EmailListRecipientQuery query = new EmailListRecipientQuery(Domain, emailList);
            query.Recipient = recipientAddress;

            emailListRecipientService.Delete(query.Uri);
        }
        /// <summary>
        /// Retrieves a page of at most 100 subscribers to an email list.
        /// Email addresses are ordered case-insensitively by ASCII value.
        /// </summary>
        /// <param name="emailList">the name of the email list for which you
        /// are retrieving recipients</param>
        /// <param name="startRecipient">the first email address that should
        /// appear in your result set</param>
        /// <returns>a feed containing the matching subscribers</returns>
        public EmailListRecipientFeed RetrievePageOfRecipients(string emailList, string startRecipient)
        {
            EmailListRecipientQuery query = new EmailListRecipientQuery(Domain, emailList);
            query.StartRecipient = startRecipient;

            return emailListRecipientService.Query(query);
        }
        /// <summary>
        /// Retrieves list of all of the subscribers to an email list.
        /// </summary>
        /// <param name="emailList">the name of the email list for which you wish to
        /// retrieve a subscriber list</param>
        /// <returns>a feed containing all of the subscribers to this email list</returns>
        public EmailListRecipientFeed RetrieveAllRecipients(string emailList)
        {
            EmailListRecipientQuery query = new EmailListRecipientQuery(Domain, emailList);

            return emailListRecipientService.Query(query);
        }
        /// <summary>
        /// Adds the specified recipient to an email list.
        /// </summary>
        /// <param name="recipientAddress">the email address that is being added</param>
        /// <param name="emailList">the email address to which the address is being added</param>
        /// <returns>the newly inserted EmailListRecipientEntry</returns>
        public EmailListRecipientEntry AddRecipientToEmailList(string recipientAddress, string emailList)
        {
            EmailListRecipientQuery query = new EmailListRecipientQuery(Domain, emailList);
            EmailListRecipientEntry entry = new EmailListRecipientEntry(recipientAddress);

            return emailListRecipientService.Insert(query.Uri, entry);
        }
Exemple #10
0
        /// <summary>
        /// Retrieves list of all of the subscribers to an email list.
        /// </summary>
        /// <param name="emailList">the name of the email list for which you wish to
        /// retrieve a subscriber list</param>
        /// <returns>a feed containing all of the subscribers to this email list</returns>
        public EmailListRecipientFeed RetrieveAllRecipients(string emailList)
        {
            EmailListRecipientQuery query = new EmailListRecipientQuery(Domain, emailList);

            return(emailListRecipientService.Query(query));
        }
 public void Init()
 {
     query = new EmailListRecipientQuery("example.com", "testList");
 }