public void SaveAndReadTest() { Who recipient = new Who(); recipient.Email = "*****@*****.**"; recipient.Rel = Who.RelType.MESSAGE_TO; entry.Recipient = recipient; StringBuilder sb = new StringBuilder(); XmlWriter writer = new XmlTextWriter(new StringWriter(sb)); entry.SaveToXml(writer); writer.Close(); XmlDocument document = new XmlDocument(); document.LoadXml(sb.ToString()); EmailListRecipientEntry newEntry = new EmailListRecipientEntry(); foreach (XmlNode node in document.FirstChild.ChildNodes) { ExtensionElementEventArgs args = new ExtensionElementEventArgs(); args.ExtensionElement = node; args.Base = newEntry; newEntry.Parse(args, new AtomFeedParser()); } Assert.AreEqual(recipient.Email, newEntry.Recipient.Email, "Parsed entry should have same recipient as original entry"); }
/// <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> /// Overridden Delete method that throws AppsException /// </summary> /// <param name="entry"></param> public void Delete(EmailListRecipientEntry entry) { try { base.Delete(entry); } catch (GDataRequestException e) { AppsException a = AppsException.ParseAppsException(e); throw (a == null ? e : a); } }
/// <summary> /// Inserts a new email list recipient entry into the feed at the /// specified URI. /// </summary> /// <param name="feedUri">the URI of the feed into which this entry should be inserted</param> /// <param name="entry">the entry to insert</param> /// <returns>the inserted entry</returns> public EmailListRecipientEntry Insert(Uri feedUri, EmailListRecipientEntry entry) { try { return(base.Insert(feedUri, entry) as EmailListRecipientEntry); } catch (GDataRequestException e) { AppsException a = AppsException.ParseAppsException(e); throw (a == null ? e : a); } }
/// <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> /// Inserts a new email list recipient entry into the feed at the /// specified URI. /// </summary> /// <param name="feedUri">the URI of the feed into which this entry should be inserted</param> /// <param name="entry">the entry to insert</param> /// <returns>the inserted entry</returns> public EmailListRecipientEntry Insert(Uri feedUri, EmailListRecipientEntry entry) { try { return base.Insert(feedUri, entry) as EmailListRecipientEntry; } catch (GDataRequestException e) { AppsException a = AppsException.ParseAppsException(e); throw (a == null ? e : a); } }
public void Init() { entry = new EmailListRecipientEntry(); }