protected override void InternalSave(ConfigurableObject instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            MailboxCalendarFolder mailboxCalendarFolder = instance as MailboxCalendarFolder;

            if (mailboxCalendarFolder == null)
            {
                throw new NotSupportedException("Save: " + instance.GetType().FullName);
            }
            if (mailboxCalendarFolder.PublishEnabled)
            {
                SharingPolicy sharingPolicy = DirectoryHelper.ReadSharingPolicy(base.MailboxSession.MailboxOwner.MailboxInfo.MailboxGuid, base.MailboxSession.MailboxOwner.MailboxInfo.IsArchive, base.MailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid));
                if (sharingPolicy == null || !sharingPolicy.Enabled || !sharingPolicy.IsAllowedForAnonymousCalendarSharing())
                {
                    throw new NotAllowedPublishingByPolicyException();
                }
                SharingPolicyAction allowedForAnonymousCalendarSharing = sharingPolicy.GetAllowedForAnonymousCalendarSharing();
                int maxAllowed = PolicyAllowedDetailLevel.GetMaxAllowed(allowedForAnonymousCalendarSharing);
                if (mailboxCalendarFolder.DetailLevel > (DetailLevelEnumType)maxAllowed)
                {
                    throw new NotAllowedPublishingByPolicyException(mailboxCalendarFolder.DetailLevel, (DetailLevelEnumType)maxAllowed);
                }
            }
            MailboxFolderId mailboxFolderId = mailboxCalendarFolder.MailboxFolderId;
            StoreObjectId   folderId        = mailboxFolderId.StoreObjectIdValue ?? base.ResolveStoreObjectIdFromFolderPath(mailboxFolderId.MailboxFolderPath);

            if (folderId == null || folderId.ObjectType != StoreObjectType.CalendarFolder)
            {
                throw new CantFindCalendarFolderException(mailboxFolderId);
            }
            using (CalendarFolder calendarFolder = CalendarFolder.Bind(base.MailboxSession, folderId))
            {
                ExtendedFolderFlags?valueAsNullable = calendarFolder.GetValueAsNullable <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags);
                if (valueAsNullable != null && (valueAsNullable.Value & ExtendedFolderFlags.PersonalShare) != (ExtendedFolderFlags)0)
                {
                    throw new CannotShareFolderException(ServerStrings.CannotShareOtherPersonalFolder);
                }
                this.SaveSharingAnonymous(mailboxCalendarFolder, folderId);
                if (!mailboxCalendarFolder.PublishEnabled)
                {
                    mailboxCalendarFolder.PublishedCalendarUrl = null;
                    mailboxCalendarFolder.PublishedICalUrl     = null;
                }
                UserConfigurationDictionaryHelper.Save(mailboxCalendarFolder, MailboxCalendarFolder.CalendarFolderConfigurationProperties, (bool createIfNonexisting) => UserConfigurationHelper.GetPublishingConfiguration(this.MailboxSession, folderId, createIfNonexisting));
                if (MailboxCalendarFolderDataProvider.UpdateExtendedFolderFlags(mailboxCalendarFolder, calendarFolder))
                {
                    calendarFolder.Save();
                }
            }
        }
Beispiel #2
0
 internal static ConfigurableObject Fill(ConfigurableObject configObject, ProviderPropertyDefinition[] appliedProperties, UserConfigurationDictionaryHelper.GetDictionaryUserConfigurationDelegate getDictionaryUserConfigurationDelegate)
 {
     Util.ThrowOnNullArgument(configObject, "configObject");
     Util.ThrowOnNullArgument(appliedProperties, "appliedProperties");
     using (UserConfiguration userConfiguration = getDictionaryUserConfigurationDelegate(false))
     {
         if (userConfiguration == null)
         {
             return(null);
         }
         UserConfigurationDictionaryHelper.Fill(userConfiguration, configObject, appliedProperties);
     }
     return(configObject);
 }
        protected override IEnumerable <T> InternalFindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize)
        {
            if (sortBy != null)
            {
                throw new NotSupportedException("sortBy");
            }
            if (rootId == null)
            {
                throw new NotSupportedException("rootId must be specified");
            }
            if (!(rootId is MailboxFolderId))
            {
                throw new NotSupportedException("rootId: " + rootId.GetType().FullName);
            }
            if (!typeof(MailboxCalendarFolder).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()))
            {
                throw new NotSupportedException("FindPaged: " + typeof(T).FullName);
            }
            MailboxFolderId mailboxFolderId = (MailboxFolderId)rootId;
            StoreObjectId   folderId        = mailboxFolderId.StoreObjectIdValue ?? base.ResolveStoreObjectIdFromFolderPath(mailboxFolderId.MailboxFolderPath);

            if (folderId == null)
            {
                throw new CantFindCalendarFolderException(mailboxFolderId);
            }
            using (Folder folder = Folder.Bind(base.MailboxSession, folderId))
            {
                if (!StringComparer.OrdinalIgnoreCase.Equals(folder.ClassName, "IPF.Appointment"))
                {
                    throw new CantFindCalendarFolderException(mailboxFolderId);
                }
            }
            MailboxCalendarFolder mailboxCalendarFolder = (MailboxCalendarFolder)((object)((default(T) == null) ? Activator.CreateInstance <T>() : default(T)));

            mailboxCalendarFolder.MailboxFolderId = mailboxFolderId;
            UserConfigurationDictionaryHelper.Fill(mailboxCalendarFolder, MailboxCalendarFolder.CalendarFolderConfigurationProperties, (bool createIfNonexisting) => UserConfigurationHelper.GetPublishingConfiguration(this.MailboxSession, folderId, createIfNonexisting));
            yield return((T)((object)mailboxCalendarFolder));

            yield break;
        }
Beispiel #4
0
 protected override void InternalSave(TObject configObject)
 {
     base.InternalSave(configObject);
     UserConfigurationDictionaryHelper.Save(configObject, this.saveMode, this.AppliedProperties.ToArray(), (bool createIfNonexisting) => this.ConfigurationGetter(base.Session, base.Configuration, UserConfigurationTypes.Dictionary, createIfNonexisting));
 }
Beispiel #5
0
 internal static void Save(ConfigurableObject configObject, ProviderPropertyDefinition[] appliedProperties, UserConfigurationDictionaryHelper.GetDictionaryUserConfigurationDelegate getDictionaryUserConfigurationDelegate)
 {
     UserConfigurationDictionaryHelper.Save(configObject, SaveMode.NoConflictResolution, appliedProperties, getDictionaryUserConfigurationDelegate);
 }