コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
 public void Init()
 {
     entry = new MailItemEntry();
 }