internal static void Save(ConfigurableObject configObject, SaveMode saveMode, ProviderPropertyDefinition property, UserConfigurationXmlHelper.GetXmlUserConfigurationDelegate getXmlUserConfigurationDelegate) { Util.ThrowOnNullArgument(configObject, "configObject"); Util.ThrowOnNullArgument(property, "property"); bool flag = false; do { using (UserConfiguration userConfiguration = getXmlUserConfigurationDelegate(!flag)) { using (Stream xmlStream = userConfiguration.GetXmlStream()) { DataContractSerializer dataContractSerializer = new DataContractSerializer(property.Type); xmlStream.SetLength(0L); dataContractSerializer.WriteObject(xmlStream, configObject[property]); } try { userConfiguration.Save(saveMode); break; } catch (ObjectExistedException) { if (flag) { throw; } flag = true; } } }while (flag); }
private void ApplyBooleanConfigurationSetting(ConfigurableObject <T> cfgObject, ConfigurableProperty cfgProperty, ConfigurationSetting cfgSetting) { Type propertyType = cfgProperty.PropertyMetadata.PropertyInfo.PropertyType; bool?value = cfgSetting.Value.TryParseBoolean(); if (propertyType == (typeof(bool))) { if (value == null) { throw new ConfigurationErrorsException(String.Format( "Unable to apply configuration setting [{0}: {1}] to property [{2}/{3}]. [{1}] can not be converted to a boolean value.", cfgSetting.Name, cfgSetting.Value, cfgObject.TypeMetadata.Type.Name, cfgProperty.PropertyMetadata.PropertyInfo .Name)); } cfgProperty.PropertyMetadata.PropertyInfo.SetValue(cfgObject.Target, value.Value); } else if (propertyType == (typeof(bool?))) { cfgProperty.PropertyMetadata.PropertyInfo.SetValue(cfgObject.Target, value); } }
public virtual IEnumerable <T> FindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) where T : IConfigurable, new() { base.CheckDisposed(); if (!typeof(ConfigurableObject).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())) { throw new NotSupportedException("FindPaged: " + typeof(T).FullName); } foreach (T item in this.InternalFindPaged <T>(filter, rootId, deepSearch, sortBy, pageSize)) { ConfigurableObject userConfigurationObject = (ConfigurableObject)((object)item); foreach (PropertyDefinition propertyDefinition in userConfigurationObject.ObjectSchema.AllProperties) { ProviderPropertyDefinition providerPropertyDefinition = propertyDefinition as ProviderPropertyDefinition; if (providerPropertyDefinition != null && !providerPropertyDefinition.IsCalculated) { object obj = null; userConfigurationObject.propertyBag.TryGetField(providerPropertyDefinition, ref obj); userConfigurationObject.InstantiationErrors.AddRange(providerPropertyDefinition.ValidateProperty(obj ?? providerPropertyDefinition.DefaultValue, userConfigurationObject.propertyBag, true)); } } userConfigurationObject.ResetChangeTracking(true); yield return(item); } yield break; }
protected virtual ConfigurableObject <T> ApplyConfigurationSettings(ConfigurableObject <T> cfgObject, IEnumerable <ConfigurationSetting> cfgSettings) { List <ConfigurationSetting> cfgSettingsList = cfgSettings.ToList(); foreach (ConfigurableProperty cfgProperty in cfgObject.Properties) { var cfgSettingDictionary = cfgSettingsList .Where(cs => cfgProperty.PrioritizedSettingNames.Contains(cs.Name)) .ToDictionary(cs => cs.Name); if (cfgSettingDictionary.Any()) { var settingName = cfgProperty.PrioritizedSettingNames.First(cfgSettingDictionary.ContainsKey); ApplyConfigurationSetting(cfgObject, cfgProperty, cfgSettingDictionary[settingName]); } else if (cfgProperty.IsRequired) { throw new ConfigurationErrorsException( String.Format( "Unable to configure the required property [{0}/{1}]. None of the following configuration setting(s) were found: [{2}].", cfgObject.TypeMetadata.Type.Name, cfgProperty.PropertyMetadata.PropertyInfo.Name, String.Join(", ", cfgProperty.PrioritizedSettingNames))); } } return(cfgObject); }
public T Spawn <T>(ConfigurableObject template, Transform parent = null, Vector3?position = null) where T : ConfigurableObject { T retObject = PoolBoss.Spawn(template.transform, Vector3.zero, Quaternion.identity, null, false).GetComponent <T>(); if (retObject != null) { if (parent != null) { retObject.transform.SetParent(parent); } if (position.HasValue) { retObject.transform.position = position.Value; } retObject.gameObject.SetActive(true); ISpawnableObject[] spawnListeners = retObject.GetComponents <ISpawnableObject>(); if (spawnListeners != null && spawnListeners.Length > 0) { for (int i = 0; i < spawnListeners.Length; ++i) { spawnListeners[i].OnSpawned(); } } return(retObject); } else { Debug.LogError("Could not spawn template!"); return(null); } }
private void ParseConfigurableObject(ConfigurableObject configurableObject, ICollection <PropertyDefinition> propertyDefinitionCollection) { if (configurableObject == null) { ExTraceGlobals.RequestRoutingTracer.TraceDebug((long)this.GetHashCode(), "{0}: Trying to parse null configurable object.", new object[] { TraceContext.Get() }); return; } if (0 < propertyDefinitionCollection.Count) { this.propertyMap = new Dictionary <PropertyDefinition, object>(propertyDefinitionCollection.Count); using (IEnumerator <PropertyDefinition> enumerator = propertyDefinitionCollection.GetEnumerator()) { while (enumerator.MoveNext()) { PropertyDefinition propertyDefinition = enumerator.Current; if (configurableObject[propertyDefinition] == null) { ExTraceGlobals.RequestRoutingTracer.TraceDebug <object, PropertyDefinition>((long)this.GetHashCode(), "{0}: {1} property was null.", TraceContext.Get(), propertyDefinition); } this.propertyMap[propertyDefinition] = configurableObject[propertyDefinition]; } return; } } ExTraceGlobals.RequestRoutingTracer.TraceError <object, int>((long)this.GetHashCode(), "{0}: Property definition collection contains {1} property definitions, nothing is parsed in RecipientData.", TraceContext.Get(), propertyDefinitionCollection.Count); }
// Token: 0x06000F81 RID: 3969 RVA: 0x0002E02C File Offset: 0x0002C22C protected virtual void FillProperty(Type type, PSObject psObject, ConfigurableObject configObject, string propertyName) { if (propertyName == "Identity") { configObject.propertyBag[ADObjectSchema.Id] = MockObjectCreator.GetSingleProperty(psObject.Members[propertyName].Value, ADObjectSchema.Id.Type); return; } if (propertyName == "WhenChanged") { if (psObject.Members[propertyName].Value is DateTime) { configObject.propertyBag.DangerousSetValue(ADObjectSchema.WhenChangedRaw, ((DateTime)psObject.Members[propertyName].Value).ToString("yyyyMMddHHmmss'.0Z'", CultureInfo.InvariantCulture)); return; } } else { IEnumerable <PropertyDefinition> source = from c in configObject.ObjectSchema.AllProperties where c.Name == propertyName select c; if (source.Count <PropertyDefinition>() == 1) { PropertyDefinition propertyDefinition = source.First <PropertyDefinition>(); object value = psObject.Members[propertyName].Value; if (value != null) { object propertyBasedOnDefinition = MockObjectCreator.GetPropertyBasedOnDefinition(propertyDefinition, value); configObject.propertyBag[propertyDefinition] = propertyBasedOnDefinition; } } } }
protected void FixOrganizationalUnitRoot(IConfigurable configurable) { ADObject adobject = configurable as ADObject; if (adobject != null) { if (adobject.OrganizationalUnitRoot == null) { adobject[ADObjectSchema.OrganizationalUnitRoot] = this.TenantId; return; } } else { ConfigurablePropertyBag configurablePropertyBag = configurable as ConfigurablePropertyBag; if (configurablePropertyBag != null) { configurablePropertyBag[ADObjectSchema.OrganizationalUnitRoot] = this.TenantId; return; } ConfigurableObject configurableObject = configurable as ConfigurableObject; if (configurableObject != null) { configurableObject[ADObjectSchema.OrganizationalUnitRoot] = this.TenantId; } } }
protected override void InternalDelete(ConfigurableObject instance) { PublicFolder publicFolder = instance as PublicFolder; if (publicFolder == null) { throw new NotSupportedException(ServerStrings.ExceptionIsNotPublicFolder(instance.GetType().FullName)); } if (publicFolder.ObjectState == ObjectState.Deleted) { throw new InvalidOperationException(ServerStrings.ExceptionObjectHasBeenDeleted); } AggregateOperationResult aggregateOperationResult = this.PublicFolderSession.Delete(DeleteItemFlags.HardDelete, new StoreId[] { this.PublicFolderSession.IdConverter.GetSessionSpecificId(publicFolder.InternalFolderIdentity.ObjectId) }); if (aggregateOperationResult != null && aggregateOperationResult.OperationResult != OperationResult.Succeeded) { StringBuilder stringBuilder = new StringBuilder(); foreach (GroupOperationResult groupOperationResult in aggregateOperationResult.GroupOperationResults) { if (groupOperationResult.OperationResult != OperationResult.Succeeded && groupOperationResult.Exception != null) { stringBuilder.AppendLine(groupOperationResult.Exception.ToString()); } } throw new StoragePermanentException(ServerStrings.ErrorFailedToDeletePublicFolder(publicFolder.Identity.ToString(), stringBuilder.ToString())); } }
private T getSpawnedTemplate <T>(string id) where T : ConfigurableObject { if (_spawnedTemplates.ContainsKey(id)) { if (_spawnedTemplates[id] != null) { return(_spawnedTemplates[id] as T); } else { //If a template in the list is null, then we are possibly accessing it after a scene change and they were cleaned up. // Clear the list and spawn new ones. _spawnedTemplates.Clear(); } } if (Exists <T>(id)) { ConfigurableObject templateInstance = Instantiate(getRawTemplate <T>(id)).GetComponent <ConfigurableObject>(); if (_templateRoot == null) { _templateRoot = new GameObject("SpawnedTemplates").transform; } templateInstance.transform.SetParent(_templateRoot); templateInstance.transform.localPosition = Vector3.zero; templateInstance.gameObject.SetActive(false); _spawnedTemplates.Add(id, templateInstance); return(templateInstance as T); } return(null); }
// Token: 0x06000F80 RID: 3968 RVA: 0x0002DF3C File Offset: 0x0002C13C protected override void FillProperties(Type type, PSObject psObject, object dummyObject, IList <string> properties) { ConfigurableObject configurableObject = dummyObject as ConfigurableObject; if (configurableObject == null) { throw new ArgumentException("This method only support ConfigurableObject; please override this method if not this type!"); } if (psObject.Members["ExchangeVersion"] != null) { PropertyBag propertyBag = configurableObject.propertyBag; ExchangeObjectVersion exchangeObjectVersion = MockObjectCreator.GetPropertyBasedOnDefinition(propertyBag.ObjectVersionPropertyDefinition, psObject.Members["ExchangeVersion"].Value) as ExchangeObjectVersion; if (exchangeObjectVersion != null) { configurableObject.SetExchangeVersion(exchangeObjectVersion); } } foreach (PSMemberInfo psmemberInfo in psObject.Members) { if (properties.Contains(psmemberInfo.Name)) { this.FillProperty(type, psObject, configurableObject, psmemberInfo.Name); } } configurableObject.ResetChangeTracking(); }
// Token: 0x06001659 RID: 5721 RVA: 0x00054610 File Offset: 0x00052810 public static bool TryConvertOutputObjectKeyProperties(ConvertOutputPropertyEventArgs args, out object convertedValue) { convertedValue = null; ConfigurableObject configurableObject = args.ConfigurableObject; PropertyDefinition property = args.Property; string propertyInStr = args.PropertyInStr; object value = args.Value; if (value == null) { return(false); } if (!PswsKeyProperties.IsKeyProperty(configurableObject, property, propertyInStr)) { return(false); } if (value is string) { convertedValue = UrlTokenConverter.UrlTokenEncode((string)value); return(true); } if (value is ObjectId) { convertedValue = new UrlTokenEncodedObjectId(value.ToString()); return(true); } if (value is IUrlTokenEncode) { ((IUrlTokenEncode)value).ReturnUrlTokenEncodedString = true; convertedValue = value; return(true); } throw new NotSupportedException(string.Format("Value with type {0} is not supported.", value.GetType())); }
internal static void Apply(ICollection <PropertyUpdateXML> updates, ConfigurableObject targetObject) { if (updates == null) { return; } foreach (PropertyUpdateXML propertyUpdateXML in updates) { ProviderPropertyDefinition providerPropertyDefinition = null; foreach (PropertyDefinition propertyDefinition in targetObject.ObjectSchema.AllProperties) { if (string.Compare(propertyDefinition.Name, propertyUpdateXML.Property.PropertyName, StringComparison.InvariantCultureIgnoreCase) == 0) { providerPropertyDefinition = (propertyDefinition as ProviderPropertyDefinition); break; } } if (providerPropertyDefinition == null) { MrsTracer.Common.Warning("Ignoring property update for '{0}', no such property found in the schema.", new object[] { propertyUpdateXML.Property.PropertyName }); } else { propertyUpdateXML.Property.TryApplyChange(providerPropertyDefinition, targetObject, propertyUpdateXML.Operation); } } }
public UnifiedPolicySyncNotificationIdParameter(ConfigurableObject configurableObject) { if (configurableObject == null) { throw new ArgumentNullException("configurableObject"); } ((IIdentityParameter)this).Initialize(configurableObject.Identity); }
// Token: 0x06000FBD RID: 4029 RVA: 0x0002FEB0 File Offset: 0x0002E0B0 protected override void FillProperty(Type type, PSObject psObject, ConfigurableObject configObject, string propertyName) { if (propertyName == "DisplaySenderName") { configObject.propertyBag[DomainContentConfigSchema.DisplaySenderName] = MockObjectCreator.GetPropertyBasedOnDefinition(DomainContentConfigSchema.DisplaySenderName, psObject.Members[propertyName].Value); } base.FillProperty(type, psObject, configObject, propertyName); }
// Token: 0x06000F9B RID: 3995 RVA: 0x0002EF00 File Offset: 0x0002D100 protected override void FillProperty(Type type, PSObject psObject, ConfigurableObject configObject, string propertyName) { if (propertyName == "RequireSenderAuthenticationEnabled") { configObject.propertyBag[MailEnabledRecipientSchema.RequireSenderAuthenticationEnabled] = MockObjectCreator.GetSingleProperty(psObject.Members[propertyName].Value, MailEnabledRecipientSchema.RequireSenderAuthenticationEnabled.Type); return; } base.FillProperty(type, psObject, configObject, propertyName); }
public virtual T Configure(T @object, string objectName = null) { ConfigurableObject <T> cfgObject = ToConfigurableObject(@object, objectName); IEnumerable <ConfigurationSetting> cfgSettings = GetConfigurationSettings(); ApplyConfigurationSettings(cfgObject, cfgSettings); return(cfgObject.Target); }
// Token: 0x06000F92 RID: 3986 RVA: 0x0002EA48 File Offset: 0x0002CC48 protected override void FillProperty(Type type, PSObject psObject, ConfigurableObject configObject, string propertyName) { if (propertyName == "AutomaticSpeechRecognitionEnabled") { configObject.propertyBag[UMMailboxSchema.ASREnabled] = MockObjectCreator.GetSingleProperty(psObject.Members[propertyName].Value, UMMailboxSchema.ASREnabled.Type); return; } base.FillProperty(type, psObject, configObject, propertyName); }
// Token: 0x06000FAF RID: 4015 RVA: 0x0002F6FC File Offset: 0x0002D8FC protected override void FillProperty(Type type, PSObject psObject, ConfigurableObject configObject, string propertyName) { if (propertyName == "RetentionPolicyTagLinks") { configObject.propertyBag[RetentionPolicySchema.RetentionPolicyTagLinks] = MockObjectCreator.GetPropertyBasedOnDefinition(RetentionPolicySchema.RetentionPolicyTagLinks, psObject.Members[propertyName].Value); return; } base.FillProperty(type, psObject, configObject, propertyName); }
public InboxRuleIdParameter(ConfigurableObject configurableObject) { if (configurableObject == null) { throw new ArgumentNullException("configurableObject"); } ((IIdentityParameter)this).Initialize(configurableObject.Identity); this.rawInput = configurableObject.Identity.ToString(); }
protected override void InternalSave(ConfigurableObject instance) { if (instance == null) { throw new ArgumentNullException("instance"); } MailboxFolder mailboxFolder = instance as MailboxFolder; if (mailboxFolder == null) { throw new NotSupportedException("Save: " + instance.GetType().FullName); } FolderSaveResult folderSaveResult = null; switch (mailboxFolder.ObjectState) { case ObjectState.New: try { using (Folder folder = Folder.Create(base.MailboxSession, mailboxFolder.InternalParentFolderIdentity, ObjectClass.GetObjectType(mailboxFolder.FolderClass), mailboxFolder.Name, CreateMode.CreateNew)) { mailboxFolder.SaveDataToXso(folder, new ReadOnlyCollection <XsoDriverPropertyDefinition>(new List <XsoDriverPropertyDefinition> { MailboxFolderSchema.Name, MailboxFolderSchema.InternalParentFolderIdentity })); MailboxFolderDataProvider.ValidateXsoObjectAndThrowForError(mailboxFolder.Name, folder, mailboxFolder.Schema); folderSaveResult = folder.Save(); } goto IL_FD; } catch (ObjectExistedException innerException) { throw new ObjectExistedException(ServerStrings.ErrorFolderAlreadyExists(mailboxFolder.Name), innerException); } break; case ObjectState.Unchanged: goto IL_FD; case ObjectState.Changed: break; case ObjectState.Deleted: throw new InvalidOperationException(ServerStrings.ExceptionObjectHasBeenDeleted); default: goto IL_FD; } throw new NotImplementedException("Save.Changed"); IL_FD: if (folderSaveResult != null && folderSaveResult.OperationResult != OperationResult.Succeeded) { throw folderSaveResult.ToException(ServerStrings.ErrorFolderSave(instance.Identity.ToString(), folderSaveResult.ToString())); } }
protected override void FillProperty(Type type, PSObject psObject, ConfigurableObject configObject, string propertyName) { if (propertyName == "RetentionEnabled" || propertyName == "AgeLimitForRetention" || propertyName == "RetentionAction") { PropertyInfo property = configObject.GetType().GetProperty(propertyName); property.SetValue(configObject, MockObjectCreator.GetSingleProperty(psObject.Members[propertyName].Value, property.PropertyType), null); return; } base.FillProperty(type, psObject, configObject, propertyName); }
// Token: 0x06000FC3 RID: 4035 RVA: 0x0003016C File Offset: 0x0002E36C protected override void FillProperty(Type type, PSObject psObject, ConfigurableObject configObject, string propertyName) { if (propertyName == "CallAnsweringRulesEnabled") { PropertyInfo property = configObject.GetType().GetProperty(propertyName); property.SetValue(configObject, MockObjectCreator.GetSingleProperty(psObject.Members[propertyName].Value, property.PropertyType), null); return; } base.FillProperty(type, psObject, configObject, propertyName); }
IConfigurable IConfigDataProvider.Read <T>(ObjectId identity) { IConfigurable configurable = this.ReadImpl <T>(identity); ConfigurableObject configurableObject = configurable as ConfigurableObject; if (configurableObject != null) { configurableObject.ResetChangeTracking(); } return(configurable); }
protected override void InternalSave(ConfigurableObject instance) { if (instance == null) { throw new ArgumentNullException("instance"); } UnifiedPolicyNotificationBase unifiedPolicyNotificationBase = instance as UnifiedPolicyNotificationBase; if (unifiedPolicyNotificationBase == null) { throw new NotSupportedException("Save: " + instance.GetType().FullName); } switch (unifiedPolicyNotificationBase.ObjectState) { case ObjectState.New: using (Folder folder = Folder.Bind(base.MailboxSession, base.MailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox))) { using (MessageItem messageItem = MessageItem.CreateAssociated(base.MailboxSession, folder.Id)) { this.SetNotificationMessage(messageItem, unifiedPolicyNotificationBase); messageItem.Save(SaveMode.NoConflictResolutionForceSave); messageItem.Load(); unifiedPolicyNotificationBase.StoreObjectId = messageItem.Id; } return; } break; case ObjectState.Unchanged: return; case ObjectState.Changed: break; case ObjectState.Deleted: goto IL_FE; default: return; } if (unifiedPolicyNotificationBase.StoreObjectId == null) { throw new ArgumentException("notification.StoreObjectId is null when saving for an update."); } using (MessageItem messageItem2 = MessageItem.Bind(base.MailboxSession, unifiedPolicyNotificationBase.StoreObjectId)) { this.SetNotificationMessage(messageItem2, unifiedPolicyNotificationBase); messageItem2.Save(SaveMode.NoConflictResolutionForceSave); messageItem2.Load(); return; } IL_FE: throw new InvalidOperationException(ServerStrings.ExceptionObjectHasBeenDeleted); }
public void Register(ConfigurableObject template) { if (!_templates.ContainsKey(template.TemplateID)) { _templates.Add(template.TemplateID, template); } else { Debug.LogError("Template '" + template.TemplateID + "' is already registered with TemplateManager. Please specify a unique template ID"); } }
// Token: 0x06000FB2 RID: 4018 RVA: 0x0002F918 File Offset: 0x0002DB18 protected override void FillProperties(Type type, PSObject psObject, object dummyObject, IList <string> properties) { ConfigurableObject configurableObject = dummyObject as ConfigurableObject; if (configurableObject == null) { throw new ArgumentException("This method only support ConfigurableObject; please override this method if not this type!"); } this.FillProperty(type, psObject, configurableObject, "DistinguishedName"); base.FillProperties(type, psObject, dummyObject, properties); }
internal static RecipientData Create(EmailAddress emailAddress, ConfigurableObject configurableObject, ICollection <PropertyDefinition> propertyDefinitionCollection) { if (Testability.HandleSmtpAddressAsContact(emailAddress.Address)) { return(RecipientData.CreateAsContact(emailAddress)); } RecipientData recipientData = new RecipientData(emailAddress); recipientData.ParseConfigurableObject(configurableObject, propertyDefinitionCollection); return(recipientData); }
// Token: 0x06000599 RID: 1433 RVA: 0x00015554 File Offset: 0x00013754 protected virtual TPublicObject CreateBlankPublicObjectInstance() { TPublicObject tpublicObject = (default(TPublicObject) == null) ? Activator.CreateInstance <TPublicObject>() : default(TPublicObject); ConfigurableObject configurableObject = tpublicObject as ConfigurableObject; if (configurableObject != null) { configurableObject.EnableSaveCalculatedValues(); configurableObject.InitializeSchema(); } return(tpublicObject); }
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(); } } }