internal IdAndName Update(StoreObjectId folderId, TData subscriptionData) { string text = null; using (Folder folder = Folder.Bind(this.mailboxSession, folderId, new PropertyDefinition[] { FolderSchema.PermissionChangeBlocked })) { text = folder.DisplayName; if (folder.GetValueAsNullable <bool>(FolderSchema.PermissionChangeBlocked) == null) { ExTraceGlobals.SharingTracer.TraceDebug <IExchangePrincipal, StoreObjectId>((long)this.GetHashCode(), "{0}: Remove permissions on the folder: {1}", this.mailboxSession.MailboxOwner, folderId); PermissionSet permissionSet = folder.GetPermissionSet(); permissionSet.Clear(); folder.Save(); folder.Load(); folder[FolderSchema.PermissionChangeBlocked] = true; } ExtendedFolderFlags extendedFolderFlags = this.SharingFolderFlags; ExtendedFolderFlags?valueAsNullable = folder.GetValueAsNullable <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags); if (valueAsNullable != null) { extendedFolderFlags |= valueAsNullable.Value; } ExTraceGlobals.SharingTracer.TraceDebug <IExchangePrincipal, StoreObjectId, ExtendedFolderFlags>((long)this.GetHashCode(), "{0}: Stamp extended folder flag on folder ({1}): {2}", this.mailboxSession.MailboxOwner, folderId, extendedFolderFlags); folder[FolderSchema.ExtendedFolderFlags] = extendedFolderFlags; folder.Save(); } this.CreateOrUpdateSharingBinding(subscriptionData, text, folderId); return(new IdAndName(folderId, new LocalizedString(text))); }
private static FolderTreeDataFlags ReadSharingFlags(CalendarFolder calendarFolder) { ExtendedFolderFlags valueOrDefault = calendarFolder.GetValueOrDefault <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags); FolderTreeDataFlags folderTreeDataFlags = FolderTreeDataFlags.None; foreach (ExtendedFolderFlags extendedFolderFlags in CalendarGroupEntry.mapExtendedFolderToSharingFlag.Keys) { if ((valueOrDefault & extendedFolderFlags) == extendedFolderFlags) { folderTreeDataFlags |= CalendarGroupEntry.mapExtendedFolderToSharingFlag[extendedFolderFlags]; } } return(folderTreeDataFlags); }
private void MigrateFolder(StoreObjectId folderId) { using (IFolder folder = this.xsoFactory.BindToFolder(this.session, folderId)) { folder[FolderSchema.IsPeopleConnectSyncFolder] = true; ExtendedFolderFlags valueOrDefault = folder.GetValueOrDefault <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags, (ExtendedFolderFlags)0); if ((valueOrDefault & ExtendedFolderFlags.ReadOnly) == (ExtendedFolderFlags)0) { folder[FolderSchema.ExtendedFolderFlags] = (valueOrDefault | ExtendedFolderFlags.ReadOnly); } folder.Save(); } this.session.ContactFolders.MyContactFolders.Add(folderId); }
public static ContentCountDisplay GetContentCountDisplay(object extendedFolderFlagValue, StoreObjectId folderId) { if (folderId == null) { throw new ArgumentNullException("FolderID"); } if (extendedFolderFlagValue != null && extendedFolderFlagValue is ExtendedFolderFlags) { ExtendedFolderFlags valueToTest = (ExtendedFolderFlags)extendedFolderFlagValue; if (Utilities.IsFlagSet((int)valueToTest, 2)) { return(ContentCountDisplay.ItemCount); } if (Utilities.IsFlagSet((int)valueToTest, 1)) { return(ContentCountDisplay.UnreadCount); } } return(FolderUtility.GetDefaultContentCountDisplay(folderId)); }
internal NavigationNodeFolder(MailboxSession session, bool isMyMailbox, object[] folderPropertyValues, Dictionary <PropertyDefinition, int> folderPropertyMap, string subject, Guid groupClassId, NavigationNodeGroupSection navigationNodeGroupSection, string groupName) : base(NavigationNodeType.NormalFolder, subject, navigationNodeGroupSection) { if (session == null) { throw new ArgumentNullException("session"); } Utilities.CheckAndThrowForRequiredProperty(folderPropertyMap, new PropertyDefinition[] { FolderSchema.Id, StoreObjectSchema.RecordKey, FolderSchema.ExtendedFolderFlags }); StoreObjectId objectId = ((VersionedId)folderPropertyValues[folderPropertyMap[FolderSchema.Id]]).ObjectId; ExtendedFolderFlags flags = (ExtendedFolderFlags)0; object obj = folderPropertyValues[folderPropertyMap[FolderSchema.ExtendedFolderFlags]]; if (!(obj is PropertyError)) { flags = (ExtendedFolderFlags)obj; } this.Initialize(session, isMyMailbox, objectId, folderPropertyValues[folderPropertyMap[StoreObjectSchema.RecordKey]], flags, groupClassId, groupName); base.ClearDirty(); }
// Token: 0x06001A99 RID: 6809 RVA: 0x00063744 File Offset: 0x00061944 protected override PeopleFilter[] InternalExecute() { UserContext userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true); ExchangeVersion.Current = ExchangeVersion.Latest; MailboxSession mailboxIdentityMailboxSession = base.MailboxIdentityMailboxSession; MailboxId mailboxId = new MailboxId(mailboxIdentityMailboxSession); List <PeopleFilter> list = new List <PeopleFilter>(); list.Add(this.MakePeopleFilter(mailboxIdentityMailboxSession.GetDefaultFolderId(DefaultFolderType.MyContacts), mailboxIdentityMailboxSession.GetDefaultFolderId(DefaultFolderType.Configuration), mailboxId, ClientStrings.MyContactsFolderName.ToString(), 1, true)); PeopleFilterGroupPriorityManager peopleFilterGroupPriorityManager = new PeopleFilterGroupPriorityManager(mailboxIdentityMailboxSession, new XSOFactory()); foreach (IStorePropertyBag storePropertyBag in new ContactFoldersEnumerator(mailboxIdentityMailboxSession, new XSOFactory(), ContactFoldersEnumeratorOptions.SkipHiddenFolders | ContactFoldersEnumeratorOptions.SkipDeletedFolders, PeopleFilterGroupPriorityManager.RequiredFolderProperties)) { StoreObjectId objectId = ((VersionedId)storePropertyBag.TryGetProperty(FolderSchema.Id)).ObjectId; StoreObjectId parentId = storePropertyBag.TryGetProperty(StoreObjectSchema.ParentItemId) as StoreObjectId; string valueOrDefault = storePropertyBag.GetValueOrDefault <string>(FolderSchema.DisplayName, string.Empty); int sortGroupPriority = peopleFilterGroupPriorityManager.DetermineSortGroupPriority(storePropertyBag); ExtendedFolderFlags valueOrDefault2 = storePropertyBag.GetValueOrDefault <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags, (ExtendedFolderFlags)0); bool isReadOnly = (valueOrDefault2 & ExtendedFolderFlags.ReadOnly) == ExtendedFolderFlags.ReadOnly; list.Add(this.MakePeopleFilter(objectId, parentId, mailboxId, valueOrDefault, sortGroupPriority, isReadOnly)); } if (userContext.FeaturesManager.ClientServerSettings.OwaPublicFolders.Enabled) { IFavoritePublicFoldersManager favoritePublicFoldersManager = new FavoritePublicFoldersManager(mailboxIdentityMailboxSession); List <IFavoritePublicFolder> list2 = new List <IFavoritePublicFolder>(); using (IEnumerator <IFavoritePublicFolder> enumerator2 = favoritePublicFoldersManager.EnumerateContactsFolders().GetEnumerator()) { while (enumerator2.MoveNext()) { IFavoritePublicFolder folder = enumerator2.Current; if (!list2.Exists((IFavoritePublicFolder storedFavorite) => storedFavorite.FolderId.Equals(folder.FolderId))) { list2.Add(folder); } } } if (list2.Count > 0) { for (int i = 0; i < list2.Count; i++) { list.Add(this.MakePublicFolderPeopleFilter(list2[i], i)); } } } ClientSecurityContext clientSecurityContext = base.CallContext.EffectiveCaller.ClientSecurityContext; IExchangePrincipal mailboxOwner = base.MailboxIdentityMailboxSession.MailboxOwner; AddressLists addressLists = new AddressLists(clientSecurityContext, mailboxOwner, userContext); if (addressLists.GlobalAddressList != null) { list.Add(new PeopleFilter { DisplayName = addressLists.GlobalAddressList.DisplayName, FolderId = new AddressListId { Id = addressLists.GlobalAddressList.Id.ObjectGuid.ToString() }, SortGroupPriority = 1000, IsReadOnly = true }); } if (addressLists.AllRoomsAddressList != null) { list.Add(new PeopleFilter { DisplayName = addressLists.AllRoomsAddressList.DisplayName, FolderId = new AddressListId { Id = addressLists.AllRoomsAddressList.Id.ObjectGuid.ToString() }, SortGroupPriority = 1001, IsReadOnly = true }); } foreach (AddressBookBase addressBookBase in addressLists.AllAddressLists) { if ((addressLists.GlobalAddressList == null || !addressBookBase.Id.Equals(addressLists.GlobalAddressList.Id)) && (addressLists.AllRoomsAddressList == null || !addressBookBase.Id.Equals(addressLists.AllRoomsAddressList.Id)) && !string.IsNullOrEmpty(addressBookBase.RecipientFilter) && (!addressBookBase.IsModernGroupsAddressList || userContext.FeaturesManager.ClientServerSettings.ModernGroups.Enabled)) { list.Add(new PeopleFilter { DisplayName = addressBookBase.DisplayName, FolderId = new AddressListId { Id = addressBookBase.Id.ObjectGuid.ToString() }, SortGroupPriority = (addressBookBase.IsModernGroupsAddressList ? 1009 : this.GetSortGroupPriority(addressBookBase.RecipientFilter)), IsReadOnly = true }); } } list.Sort(new PeopleFilterComparer(mailboxIdentityMailboxSession.PreferedCulture)); return(list.ToArray()); }
private void Initialize(MailboxSession session, bool isMyMailbox, StoreObjectId folderId, object recordKey, ExtendedFolderFlags flags, Guid groupClassId, string groupName) { StoreObjectId storeObjectId = Utilities.TryGetDefaultFolderId(session, DefaultFolderType.Root); if (storeObjectId != null && storeObjectId.Equals(folderId)) { throw new NotSupportedException("We don't support adding root folder to favorites."); } if (!session.IsRemote) { this.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(session.MailboxOwner); } this.NavigationNodeEntryId = folderId.ProviderLevelItemId; if (recordKey is byte[]) { this.NavigationNodeRecordKey = (byte[])recordKey; } StoreObjectId storeObjectId2 = Utilities.TryGetDefaultFolderId(session, DefaultFolderType.ToDoSearch); if (storeObjectId2 != null && storeObjectId2.Equals(folderId)) { base.NavigationNodeFlags |= NavigationNodeFlags.TodoFolder; } foreach (KeyValuePair <ExtendedFolderFlags, NavigationNodeFlags> keyValuePair in NavigationNodeFolder.mappingFromFolderFlagToNodeFlag) { if (Utilities.IsFlagSet((int)flags, (int)keyValuePair.Key)) { base.NavigationNodeFlags |= keyValuePair.Value; } } if (isMyMailbox) { base.NavigationNodeFlags |= NavigationNodeFlags.IsDefaultStore; } if (!base.IsFavorites) { this.NavigationNodeParentGroupClassId = groupClassId; this.NavigationNodeGroupName = groupName; } }
// Token: 0x06000E51 RID: 3665 RVA: 0x00056330 File Offset: 0x00054530 private void ApplyPolicyToFolder(int maxAllowedDetailLevel, FolderData folderData) { SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal, StoreId, int>((long)this.GetHashCode(), "{0}: Apply policy to a published folder {1}. MaxAllowedDetailLevel = {2}", folderData.MailboxSession.MailboxOwner, folderData.Id, maxAllowedDetailLevel); UserConfiguration publishingConfiguration = this.GetPublishingConfiguration(folderData.MailboxSession, folderData.Id); if (publishingConfiguration == null) { return; } using (publishingConfiguration) { IDictionary dictionary = null; Exception ex = null; try { dictionary = publishingConfiguration.GetDictionary(); } catch (CorruptDataException ex2) { ex = ex2; } catch (InvalidOperationException ex3) { ex = ex3; } if (ex != null) { SharingPolicyAssistant.Tracer.TraceError <IExchangePrincipal, Exception>((long)this.GetHashCode(), "{0}: Data of user configuration is invalid or corrupt. Exception = {1}", folderData.MailboxSession.MailboxOwner, ex); } else if (maxAllowedDetailLevel == 0) { if ((bool)dictionary[MailboxCalendarFolderSchema.PublishEnabled.Name]) { SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: Anonymous sharing is not allowed at all. Trying to disable.", folderData.MailboxSession.MailboxOwner); dictionary[MailboxCalendarFolderSchema.PublishEnabled.Name] = false; dictionary[MailboxCalendarFolderSchema.PublishedCalendarUrl.Name] = null; dictionary[MailboxCalendarFolderSchema.PublishedICalUrl.Name] = null; publishingConfiguration.Save(); ExtendedFolderFlags?valueAsNullable = folderData.Folder.GetValueAsNullable <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags); if (valueAsNullable != null) { ExtendedFolderFlags extendedFolderFlags = valueAsNullable.Value & (ExtendedFolderFlags)2147483647; if (valueAsNullable.Value != extendedFolderFlags) { folderData.Folder[FolderSchema.ExtendedFolderFlags] = extendedFolderFlags; folderData.IsChanged = true; } } } } else { object obj = dictionary[MailboxCalendarFolderSchema.DetailLevel.Name]; if (obj != null && (int)obj > maxAllowedDetailLevel) { SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: Anonymous sharing is not allowed with current detail level. Trying to reduce.", folderData.MailboxSession.MailboxOwner); dictionary[MailboxCalendarFolderSchema.DetailLevel.Name] = maxAllowedDetailLevel; publishingConfiguration.Save(); } } } }