public static void ValidateFolder(MailboxSession mailboxSession, StoreId sharingFolderId) { SharingEngine.GetADUser(mailboxSession); SharingEngine.GetSubscriptionData(mailboxSession, StoreId.GetStoreObjectId(sharingFolderId)); using (SharingEngine.BindToLocalFolder(mailboxSession, sharingFolderId)) { } SharingEngine.GetExternalAuthentication(mailboxSession); }
private static SharingEngine Create(MailboxSession mailboxSession, StoreId sharingFolderId) { ADUser aduser = SharingEngine.GetADUser(mailboxSession); SharingSubscriptionData subscriptionData = SharingEngine.GetSubscriptionData(mailboxSession, (StoreObjectId)sharingFolderId); SharingEngine.Tracer.TraceDebug <IExchangePrincipal, SharingSubscriptionData>(0L, "{0}: Found subscription data: {1}", mailboxSession.MailboxOwner, subscriptionData); ExternalAuthentication externalAuthentication = SharingEngine.GetExternalAuthentication(mailboxSession); return(new SharingEngine(mailboxSession.Culture, mailboxSession.MailboxOwner, sharingFolderId, subscriptionData, externalAuthentication, aduser)); }
public static bool SyncFolder(MailboxSession mailboxSession, StoreId sharingFolderId, Deadline processingDeadline) { if (!SharingEngine.tracker.Start(mailboxSession.MailboxOwner.MailboxInfo.MailboxGuid, sharingFolderId)) { SharingEngine.Tracer.TraceError <StoreId>(0L, "{0}: Folder is already syncing", sharingFolderId); throw new PendingSynchronizationException(); } bool result = true; SharingEngine sharingEngine = null; LocalFolder localFolder = null; ItemSynchronizer itemSynchronizer = null; try { SharingLog.LogEntry(mailboxSession, "Starting sync for folder " + sharingFolderId); localFolder = SharingEngine.GetLocalFolder(mailboxSession, sharingFolderId); localFolder.UpdateLastAttemptedSyncTime(); itemSynchronizer = SharingEngine.CreateItemSynchronizer(mailboxSession, localFolder); sharingEngine = SharingEngine.Create(mailboxSession, sharingFolderId); result = sharingEngine.Execute(mailboxSession, localFolder, itemSynchronizer, processingDeadline); } catch (Exception arg) { SharingLog.LogEntry(mailboxSession, string.Format("Synchronization finished unexpectedly due to the following error: {0}, External Url {1}", arg, (sharingEngine != null && sharingEngine.ExchangeService != null) ? sharingEngine.ExchangeService.Url : "Not specified")); throw; } finally { SharingEngine.UnblockFolderSync(mailboxSession.MailboxOwner.MailboxInfo.MailboxGuid, sharingFolderId); if (itemSynchronizer != null) { itemSynchronizer = null; } if (localFolder != null) { localFolder.Dispose(); localFolder = null; } if (sharingEngine != null) { sharingEngine.Dispose(); } } return(result); }
public static bool SyncFolder(MailboxSession mailboxSession, StoreId sharingFolderId) { return(SharingEngine.SyncFolder(mailboxSession, sharingFolderId, new Deadline(SharingEngine.defaultProcessingMaxTime))); }