Beispiel #1
0
        private void OnDocumentLibSynchronizationCompleted(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new InvalidOperationException("DocumentSyncJob.OnDocumentLibSynchronizationCompleted: asyncResult cannot be null here.");
            }
            DocumentLibSynchronizer documentLibSynchronizer = asyncResult.AsyncState as DocumentLibSynchronizer;

            if (documentLibSynchronizer == null)
            {
                throw new InvalidOperationException("DocumentSyncJob.OnDocumentLibSynchronizationCompleted: asyncResult.AsyncState is not DocumentLibSynchronizer");
            }
            documentLibSynchronizer.EndExecute(asyncResult);
            if (documentLibSynchronizer.LastError != null || base.IsShuttingdown)
            {
                base.LastError = documentLibSynchronizer.LastError;
                this.End();
                return;
            }
            this.SynchronizeNextDocumentLibrary();
        }
Beispiel #2
0
        private void SynchronizeNextDocumentLibrary()
        {
            DocumentLibraryInfo info = (this.documentLibraryInfos.Count > 0) ? this.documentLibraryInfos.Dequeue() : null;

            if (info != null)
            {
                try
                {
                    GrayException.MapAndReportGrayExceptions(delegate()
                    {
                        DocumentLibSynchronizer documentLibSynchronizer = new DocumentLibSynchronizer(this, this.SyncInfoEntry.MailboxSession, this.SyncInfoEntry.ResourceMonitor, info.FolderId, this.SyncInfoEntry.SiteUrl, info.SharepointId, this.credentials, ((TeamMailboxSyncConfiguration)this.Config).UseOAuth, ((TeamMailboxSyncConfiguration)this.Config).HttpDebugEnabled, this.syncCycleLogStream);
                        documentLibSynchronizer.BeginExecute(new AsyncCallback(this.OnDocumentLibSynchronizationCompleted), documentLibSynchronizer);
                    });
                    return;
                }
                catch (GrayException lastError)
                {
                    base.LastError = lastError;
                    this.End();
                    return;
                }
            }
            this.End();
        }