// Token: 0x06000832 RID: 2098 RVA: 0x00039E88 File Offset: 0x00038088 protected override bool HasSubscriptionInternal(MailboxSession mailboxSession, StoreObjectId folderId) { bool result; using (SharingSubscriptionManager sharingSubscriptionManager = new SharingSubscriptionManager(mailboxSession)) { result = (sharingSubscriptionManager.GetByLocalFolderId(folderId) != null); } return(result); }
public static void BuildFolderTree(MailboxSession mailboxSession, SyncState syncState) { StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Root); SharingSubscriptionData[] array = null; using (SharingSubscriptionManager sharingSubscriptionManager = new SharingSubscriptionManager(mailboxSession)) { array = sharingSubscriptionManager.GetAll(); } using (Folder folder = Folder.Bind(mailboxSession, defaultFolderId)) { FolderTree folderTree; using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, FolderTree.fetchProperties)) { folderTree = new FolderTree(); object[][] rows; do { rows = queryResult.GetRows(10000); for (int i = 0; i < rows.Length; i++) { MailboxSyncItemId mailboxSyncItemId = MailboxSyncItemId.CreateForNewItem(((VersionedId)rows[i][0]).ObjectId); MailboxSyncItemId mailboxSyncItemId2 = MailboxSyncItemId.CreateForNewItem((StoreObjectId)rows[i][1]); folderTree.AddFolder(mailboxSyncItemId); object obj = rows[i][3]; int num = (obj is PropertyError) ? 0 : ((int)obj); if ((num & 1073741824) != 0) { for (int j = 0; j < array.Length; j++) { if (array[j].LocalFolderId.Equals(mailboxSyncItemId.NativeId)) { folderTree.SetPermissions(mailboxSyncItemId, SyncPermissions.Readonly); folderTree.SetOwner(mailboxSyncItemId, array[j].SharerIdentity); break; } } } if (!defaultFolderId.Equals(mailboxSyncItemId2.NativeId)) { folderTree.AddFolder(mailboxSyncItemId2); folderTree.LinkChildToParent(mailboxSyncItemId2, mailboxSyncItemId); } if ((bool)rows[i][2]) { folderTree.SetHidden(mailboxSyncItemId, true); } } }while (rows.Length != 0); } syncState[CustomStateDatumType.FullFolderTree] = folderTree; syncState[CustomStateDatumType.RecoveryFullFolderTree] = syncState[CustomStateDatumType.FullFolderTree]; } }
private static SharingSubscriptionData GetSubscriptionData(MailboxSession mailboxSession, StoreObjectId sharingFolderId) { SharingSubscriptionData result; using (SharingSubscriptionManager sharingSubscriptionManager = new SharingSubscriptionManager(mailboxSession)) { SharingSubscriptionData byLocalFolderId = sharingSubscriptionManager.GetByLocalFolderId(sharingFolderId); if (byLocalFolderId == null) { SharingEngine.Tracer.TraceError <StoreObjectId>(0L, "{0}: No subscription for this folder", sharingFolderId); throw new SubscriptionNotFoundException(); } SharingEngine.Tracer.TraceDebug <StoreObjectId, SharingSubscriptionData>(0L, "{0}: Found subscription: {1}", sharingFolderId, byLocalFolderId); result = byLocalFolderId; } return(result); }
private void UpdateSubscriptionData(MailboxSession mailboxSession, Uri sharingUrl) { using (SharingSubscriptionManager sharingSubscriptionManager = new SharingSubscriptionManager(mailboxSession)) { SharingSubscriptionData sharingSubscriptionData = this.subscription; int num = 0; for (;;) { sharingSubscriptionData.SharingUrl = sharingUrl; num++; bool throwIfConflict = num > 3; sharingSubscriptionData = sharingSubscriptionManager.CreateOrUpdate(sharingSubscriptionData, throwIfConflict); if (StringComparer.OrdinalIgnoreCase.Equals(sharingSubscriptionData.SharingUrl, sharingUrl)) { break; } sharingSubscriptionData = sharingSubscriptionManager.GetByLocalFolderId(sharingSubscriptionData.LocalFolderId); } } }
private SharingSubscriptionData[] LoadAllSubscriptions() { try { if (this.requesterBudget != null) { this.requesterBudget.CheckOverBudget(); } ExchangePrincipal mailboxOwner = ExchangePrincipal.FromADUser(this.adUser, null); using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=AS")) { if (this.requesterBudget != null) { mailboxSession.AccountingObject = this.requesterBudget; } try { using (SharingSubscriptionManager sharingSubscriptionManager = new SharingSubscriptionManager(mailboxSession)) { return(sharingSubscriptionManager.GetAll()); } } catch (ObjectNotFoundException) { } } } catch (OverBudgetException handledException) { this.HandledException = handledException; } catch (ConnectionFailedPermanentException handledException2) { this.HandledException = handledException2; } catch (ObjectNotFoundException handledException3) { this.HandledException = handledException3; } catch (ConnectionFailedTransientException handledException4) { this.HandledException = handledException4; } catch (AccountDisabledException handledException5) { this.HandledException = handledException5; } catch (VirusScanInProgressException innerException) { LocalizedString localizedString = Strings.descVirusScanInProgress(this.adUser.PrimarySmtpAddress.ToString()); this.HandledException = new LocalizedException(localizedString, innerException); } catch (VirusDetectedException innerException2) { LocalizedString localizedString2 = Strings.descVirusDetected(this.adUser.PrimarySmtpAddress.ToString()); this.HandledException = new LocalizedException(localizedString2, innerException2); } catch (StoragePermanentException handledException6) { this.HandledException = handledException6; } catch (StorageTransientException handledException7) { this.HandledException = handledException7; } return(new SharingSubscriptionData[0]); }