private static object GetAccessScope(IPropertyBag properties, string prefix, ADPropertyDefinition cacheDefinition) { MultiValuedProperty <string> actions = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions]; string action = OrganizationRelationshipHelper.GetAction(actions, prefix); string targetElement = OrganizationRelationshipHelper.GetTargetElement(action); if (targetElement == null) { return(null); } Guid guid; try { guid = new Guid(targetElement); } catch (FormatException) { return(null); } catch (OverflowException) { return(null); } ADObjectId adobjectId = (ADObjectId)properties[cacheDefinition]; if (adobjectId != null && adobjectId.ObjectGuid == guid) { return(adobjectId); } return(new ADObjectId(guid)); }
private static object GetAccessLevel <T>(IPropertyBag properties, string actionPrefix, T defaultLevel) { MultiValuedProperty <string> actions = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions]; string action = OrganizationRelationshipHelper.GetAction(actions, actionPrefix); string levelElement = OrganizationRelationshipHelper.GetLevelElement(action); if (levelElement == null) { return(defaultLevel); } object result; try { result = (T)((object)Enum.Parse(typeof(T), levelElement, true)); } catch (ArgumentNullException) { result = defaultLevel; } catch (ArgumentException) { result = defaultLevel; } return(result); }
private static void SetAccessLevel <T>(T accessLevel, IPropertyBag properties, string prefix) { MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions]; string andRemoveAction = OrganizationRelationshipHelper.GetAndRemoveAction(multiValuedProperty, prefix); string targetElement = OrganizationRelationshipHelper.GetTargetElement(andRemoveAction); multiValuedProperty.Add(OrganizationRelationshipHelper.GenerateAction(prefix, accessLevel.ToString(), targetElement)); }
private static string GetAndRemoveAction(MultiValuedProperty <string> actions, string prefix) { string action = OrganizationRelationshipHelper.GetAction(actions, prefix); if (action != null) { actions.Remove(action); } return(action); }
private static void SetAccessScope <T>(ADObjectId objectId, IPropertyBag properties, string prefix, T defaultLevel) { MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions]; string target = (objectId != null) ? objectId.ObjectGuid.ToString() : null; string andRemoveAction = OrganizationRelationshipHelper.GetAndRemoveAction(multiValuedProperty, prefix); string text = OrganizationRelationshipHelper.GetLevelElement(andRemoveAction); if (text == null) { text = defaultLevel.ToString(); } multiValuedProperty.Add(OrganizationRelationshipHelper.GenerateAction(prefix, text, target)); }
internal static void SetMailTipsAccessScope(object value, IPropertyBag properties) { OrganizationRelationshipHelper.SetAccessScope <MailTipsAccessLevel>(value as ADObjectId, properties, "MSExchange.MailTipsAccessLevel:", MailTipsAccessLevel.None); }
internal static object GetMailTipsAccessScope(IPropertyBag properties) { return(OrganizationRelationshipHelper.GetAccessScope(properties, "MSExchange.MailTipsAccessLevel:", OrganizationRelationshipNonAdProperties.MailTipsAccessScopeScopeCache)); }
internal static void SetMailTipsAccessLevel(object value, IPropertyBag properties) { OrganizationRelationshipHelper.SetAccessLevel <MailTipsAccessLevel>((MailTipsAccessLevel)value, properties, "MSExchange.MailTipsAccessLevel:"); }
internal static object GetMailTipsAccessLevel(IPropertyBag properties) { return(OrganizationRelationshipHelper.GetAccessLevel <MailTipsAccessLevel>(properties, "MSExchange.MailTipsAccessLevel:", MailTipsAccessLevel.None)); }
internal static void SetFreeBusyAccessScope(object value, IPropertyBag properties) { OrganizationRelationshipHelper.SetAccessScope <FreeBusyAccessLevel>(value as ADObjectId, properties, "MSExchange.SharingCalendarFreeBusyLevel:", FreeBusyAccessLevel.None); }
internal static object GetFreeBusyAccessScope(IPropertyBag properties) { return(OrganizationRelationshipHelper.GetAccessScope(properties, "MSExchange.SharingCalendarFreeBusyLevel:", OrganizationRelationshipNonAdProperties.FreeBusyAccessScopeCache)); }
internal static void SetFreeBusyAccessLevel(object value, IPropertyBag properties) { OrganizationRelationshipHelper.SetAccessLevel <FreeBusyAccessLevel>((FreeBusyAccessLevel)value, properties, "MSExchange.SharingCalendarFreeBusyLevel:"); }
internal static object GetFreeBusyAccessLevel(IPropertyBag properties) { return(OrganizationRelationshipHelper.GetAccessLevel <FreeBusyAccessLevel>(properties, "MSExchange.SharingCalendarFreeBusyLevel:", FreeBusyAccessLevel.None)); }