private static void FetchRetentionPolicyTagDataFromService(StoreRetentionPolicyTagHelper srpth)
		{
			StoreRetentionPolicyTagHelper.InitializeServiceBinding(srpth);
			if (srpth.serviceBinding != null)
			{
				GetUserConfigurationType getUserConfiguration = new GetUserConfigurationType
				{
					UserConfigurationName = new UserConfigurationNameType
					{
						Name = "MRM",
						Item = new DistinguishedFolderIdType
						{
							Id = DistinguishedFolderIdNameType.inbox
						}
					},
					UserConfigurationProperties = (UserConfigurationPropertyType.Dictionary | UserConfigurationPropertyType.XmlData | UserConfigurationPropertyType.BinaryData)
				};
				StoreRetentionPolicyTagHelper.CallEwsWithRetries(() => srpth.serviceBinding.GetUserConfiguration(getUserConfiguration), delegate(ResponseMessageType responseMessage, int messageIndex)
				{
					GetUserConfigurationResponseMessageType getUserConfigurationResponseMessageType = responseMessage as GetUserConfigurationResponseMessageType;
					if (getUserConfigurationResponseMessageType.ResponseClass == ResponseClassType.Success && getUserConfigurationResponseMessageType.UserConfiguration != null)
					{
						if (getUserConfigurationResponseMessageType.UserConfiguration.XmlData != null)
						{
							ExTraceGlobals.ELCTracer.TraceDebug(0L, "Acquired MRM user configuration.");
							srpth.TagData = MrmFaiFormatter.Deserialize(getUserConfigurationResponseMessageType.UserConfiguration.XmlData, srpth.exchangePrincipal, out srpth.deletedTags, out srpth.retentionHoldData, true, out srpth.defaultArchiveTagData, out srpth.fullCrawlRequired);
							srpth.configItemExists = true;
						}
						else
						{
							ExTraceGlobals.ELCTracer.TraceDebug(0L, "MRM user configuration is null");
							srpth.TagData = new Dictionary<Guid, StoreTagData>();
							srpth.configItemExists = false;
						}
						return true;
					}
					if (getUserConfigurationResponseMessageType.ResponseClass == ResponseClassType.Error && getUserConfigurationResponseMessageType.ResponseCode == ResponseCodeType.ErrorItemNotFound)
					{
						ExTraceGlobals.ELCTracer.TraceDebug(0L, "MRM user configuration not found");
						srpth.TagData = new Dictionary<Guid, StoreTagData>();
						srpth.configItemExists = false;
						return true;
					}
					ExTraceGlobals.ELCTracer.TraceDebug(0L, "Getting MRM user configuration failed");
					return false;
				}, srpth);
				return;
			}
			throw new ElcUserConfigurationException(Strings.ElcUserConfigurationServiceBindingNotAvailable);
		}
Exemple #2
0
        // Token: 0x06000577 RID: 1399 RVA: 0x00029938 File Offset: 0x00027B38
        public byte[] GetMrmConfiguration(BaseFolderIdType folderId)
        {
            byte[] userConfiguration = null;
            GetUserConfigurationType getUserConfiguration = new GetUserConfigurationType
            {
                UserConfigurationName = new UserConfigurationNameType
                {
                    Name = "MRM",
                    Item = folderId
                },
                UserConfigurationProperties = (UserConfigurationPropertyType.Dictionary | UserConfigurationPropertyType.XmlData | UserConfigurationPropertyType.BinaryData)
            };

            this.CallService(() => this.ServiceBinding.GetUserConfiguration(getUserConfiguration), delegate(ResponseMessageType responseMessage, int messageIndex)
            {
                if (responseMessage.ResponseClass == ResponseClassType.Error)
                {
                    if (responseMessage.ResponseCode != ResponseCodeType.ErrorItemNotFound)
                    {
                        throw new RetryException(new ElcEwsException(ElcEwsErrorType.FailedToGetUserConfiguration, responseMessage.ResponseCode.ToString() + " : " + responseMessage.MessageText), false);
                    }
                    ElcEwsClient.Tracer.TraceDebug <string>(0L, "MRM user configuration was not found in the mailbox of {0}.", this.exchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString());
                }
                else
                {
                    GetUserConfigurationResponseMessageType getUserConfigurationResponseMessageType = responseMessage as GetUserConfigurationResponseMessageType;
                    if (getUserConfigurationResponseMessageType != null && getUserConfigurationResponseMessageType.UserConfiguration != null && getUserConfigurationResponseMessageType.UserConfiguration.XmlData != null)
                    {
                        userConfiguration = getUserConfigurationResponseMessageType.UserConfiguration.XmlData;
                    }
                    else
                    {
                        ElcEwsClient.Tracer.TraceDebug <string>(0L, "MRM user configuration was not in the GetUserConfiguration response of {0}", this.exchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString());
                    }
                }
                return(false);
            }, (Exception exception) => ElcEwsClient.WrapElcEwsException(ElcEwsErrorType.FailedToGetUserConfiguration, exception));
            return(userConfiguration);
        }
Exemple #3
0
        internal override CalendarProcessingFlags?GetCalendarConfig()
        {
            CalendarProcessingFlags  value = (CalendarProcessingFlags)CalendarConfigurationSchema.AutomateProcessing.DefaultValue;
            GetUserConfigurationType getUserConfigurationType = new GetUserConfigurationType();

            getUserConfigurationType.UserConfigurationProperties = UserConfigurationPropertyType.Dictionary;
            getUserConfigurationType.UserConfigurationName       = new UserConfigurationNameType
            {
                Name = "Calendar",
                Item = new DistinguishedFolderIdType
                {
                    Id = DistinguishedFolderIdNameType.calendar
                }
            };
            try
            {
                GetUserConfigurationResponseType userConfiguration = this.binding.GetUserConfiguration(getUserConfigurationType);
                bool flag;
                UserConfigurationType userConfigurationType = this.HandleGetUserConfigurationResponse(userConfiguration, out flag);
                if (flag)
                {
                    return(new CalendarProcessingFlags?(value));
                }
                if (userConfigurationType == null || userConfigurationType.Dictionary == null)
                {
                    Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "GetUserConfiguration returned NULL userConfigurationType.");
                    return(null);
                }
                foreach (UserConfigurationDictionaryEntryType userConfigurationDictionaryEntryType in userConfigurationType.Dictionary)
                {
                    if (userConfigurationDictionaryEntryType.DictionaryKey != null && userConfigurationDictionaryEntryType.DictionaryKey.Value != null && userConfigurationDictionaryEntryType.DictionaryKey.Value.Length > 0 && string.Compare(userConfigurationDictionaryEntryType.DictionaryKey.Value[0], CalendarConfigurationSchema.AutomateProcessing.Name, StringComparison.OrdinalIgnoreCase) == 0 && userConfigurationDictionaryEntryType.DictionaryValue != null && userConfigurationDictionaryEntryType.DictionaryValue.Value != null && userConfigurationDictionaryEntryType.DictionaryValue.Value.Length > 0)
                    {
                        CalendarProcessingFlags value2 = (CalendarProcessingFlags)Enum.Parse(typeof(CalendarProcessingFlags), userConfigurationDictionaryEntryType.DictionaryValue.Value[0]);
                        return(new CalendarProcessingFlags?(value2));
                    }
                }
            }
            catch (ProtocolViolationException exception)
            {
                this.HandleRemoteException(exception);
            }
            catch (SecurityException exception2)
            {
                this.HandleRemoteException(exception2);
            }
            catch (ArgumentException exception3)
            {
                this.HandleRemoteException(exception3);
            }
            catch (InvalidOperationException exception4)
            {
                this.HandleRemoteException(exception4);
            }
            catch (NotSupportedException exception5)
            {
                this.HandleRemoteException(exception5);
            }
            catch (XmlException exception6)
            {
                this.HandleRemoteException(exception6);
            }
            catch (XPathException exception7)
            {
                this.HandleRemoteException(exception7);
            }
            catch (SoapException exception8)
            {
                this.HandleRemoteException(exception8);
            }
            catch (IOException exception9)
            {
                this.HandleRemoteException(exception9);
            }
            return(new CalendarProcessingFlags?(value));
        }