Esempio n. 1
0
        /// <summary>
        /// Iterate through the mailfolders collection and process each item with the provided callback.
        /// </summary>
        public async Task Iterate()
        {
            var more = true;

            while (more)
            {
                foreach (var item in this.mailfolders)
                {
                    callback(item);
                }

                if (mailfolders.NextPageRequest != null)
                {
                    this.mailfolders = await mailfolders.NextPageRequest.GetAsync();
                }
                else
                {
                    more = false;
                }

                if (this.mailfolders.AdditionalData.ContainsKey(Constants.DeltaLinkFeedAnnotation))
                {
                    DeltaLink = this.mailfolders.AdditionalData[Constants.DeltaLinkFeedAnnotation] as string;
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor for the PageIterator
 /// <param name="mailFolders">Instance of <see cref="IMailFolderDeltaCollectionPage"/> that holds
 /// the collection mail folders to be processed.</param>
 /// <param name="callback">Call back to process each item in collection.</param>
 /// </summary>
 public PageIterator(IMailFolderDeltaCollectionPage mailFolders, Action <MailFolder> callback)
 {
     this.mailfolders = mailFolders;
     this.callback    = callback;
 }