/// <summary> /// Helper method to set up a new <code>MailItemEntry</code>. /// </summary> /// <param name="batchId">the batch ID for this entry</param> /// <returns>the newly created <code>MailItemEntry</code></returns> private static MailItemEntry SetupMailItemEntry(string batchId) { MailItemEntry entry = new MailItemEntry(); entry.Labels.Add(new LabelElement("Friends")); entry.Labels.Add(new LabelElement("Event Invitations")); entry.MailItemProperties.Add(MailItemPropertyElement.INBOX); entry.MailItemProperties.Add(MailItemPropertyElement.STARRED); entry.MailItemProperties.Add(MailItemPropertyElement.UNREAD); entry.Rfc822Msg = new Rfc822MsgElement(GenerateRandomRfcText()); entry.BatchData = new GDataBatchEntryData(); entry.BatchData.Id = batchId; return(entry); }
/// <summary> /// Demonstrates inserting several mail items in a batch. /// </summary> /// <param name="numToInsert">the number of entries to insert</param> /// <returns>a <code>MailItemFeed</code> with the results of the insertions</returns> private static MailItemFeed BatchInsertMailItems(int numToInsert) { MailItemEntry[] entries = new MailItemEntry[numToInsert]; // Set up the mail item entries to insert. for (int i = 0; i < numToInsert; i++) { entries[i] = SetupMailItemEntry(i.ToString()); } // Execute the batch request and print the results. MailItemFeed batchResult = mailItemService.Batch(domain, destinationUser, entries); foreach (AtomEntry entry in batchResult.Entries) { GDataBatchEntryData batchData = entry.BatchData; Console.WriteLine("Mail message {0}: {1} {2}", batchData.Id, batchData.Status.Code, batchData.Status.Reason); } return(batchResult); }
public void Init() { entry = new MailItemEntry(); }