コード例 #1
0
        internal static bool ResetUMPin(ADUser aduser, string passwd)
        {
            UmConnectivityCredentialsHelper.DebugTrace("Inside UmConnectivityCredentialsHelper: ResetUMPin", new object[0]);
            string pin;

            try
            {
                UMMailboxPolicy policyFromUser = Utility.GetPolicyFromUser(aduser);
                if (!UmConnectivityCredentialsHelper.GetRandomPINFromPasswd(passwd, policyFromUser.MinPINLength, out pin))
                {
                    UmConnectivityCredentialsHelper.DebugTrace("Inside ResetUMPin(): didnt get pin", new object[0]);
                    return(false);
                }
            }
            catch (LocalizedException ex)
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside ResetUMPin(): got Exception = {0}", new object[]
                {
                    ex.ToString()
                });
                return(false);
            }
            LocalizedException ex2 = UmConnectivityCredentialsHelper.SaveUMPin(aduser, pin);

            if (ex2 != null)
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside ResetUMPin(): SaveUMPin Exception = {0}", new object[]
                {
                    ex2.ToString()
                });
                return(false);
            }
            return(true);
        }
コード例 #2
0
        private static bool FindPassword(ExchangePrincipal ep, NetworkCredential nc)
        {
            UmConnectivityCredentialsHelper.DebugTrace("Inside FindPassword()", new object[0]);
            LocalizedException ex = TestConnectivityCredentialsManager.LoadAutomatedTestCasConnectivityInfo(ep, nc);

            if (ex != null)
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside FindPassword(): TestConnectivityCredentialsManager.LoadAutomatedTestCasConnectivityInfo returned : {0}", new object[]
                {
                    ex.ToString()
                });
                return(false);
            }
            return(true);
        }
コード例 #3
0
        internal static bool ResetMailboxPassword(ExchangePrincipal ep, NetworkCredential nc)
        {
            UmConnectivityCredentialsHelper.DebugTrace("Inside UmConnectivityCredentialsHelper: ResetMailboxPassword", new object[0]);
            bool flag             = false;
            LocalizedException ex = TestConnectivityCredentialsManager.ResetAutomatedCredentialsAndVerify(ep, nc, false, out flag);

            if (ex != null)
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside ResetMailboxPassword(): TestConnectivityCredentialsManager.ResetAutomatedCredentialsAndVerify returned : {0} ", new object[]
                {
                    ex.ToString()
                });
                return(false);
            }
            return(true);
        }
コード例 #4
0
 private void RegisterStorageException(ConsistencyCheckResult result, LocalizedException exception)
 {
     result.Status = CheckStatusType.CheckError;
     result.AddInconsistency(base.Context, Inconsistency.CreateInstance(RoleType.Organizer, exception.ToString(), CalendarInconsistencyFlag.StorageException, base.Context));
 }
コード例 #5
0
        private TestMigrationServerAvailabilityOutcome CreateAutodsicoverFailedOutcome(LocalizedException exception)
        {
            LocalizedString message     = exception.Data.Contains("AutoDiscoverResponseMessage") ? ((LocalizedString)exception.Data["AutoDiscoverResponseMessage"]) : exception.LocalizedString;
            string          errorDetail = exception.Data.Contains("AutoDiscoverResponseErrorDetail") ? ((string)exception.Data["AutoDiscoverResponseErrorDetail"]) : exception.ToString();

            return(TestMigrationServerAvailabilityOutcome.Create(TestMigrationServerAvailabilityResult.Failed, this.SupportsCutover, message, errorDetail));
        }
コード例 #6
0
 private void HandleException(LocalizedException e)
 {
     if (!this.MonitoringContext)
     {
         this.WriteError(e, ErrorCategory.OperationStopped, this, true);
         return;
     }
     this.monitoringData.Events.Add(new MonitoringEvent(TestMonitoringServiceBasicCmdletTask.CmdletMonitoringEventSource, 3006, EventTypeEnumeration.Error, e.ToString()));
 }
コード例 #7
0
 private void HandleException(LocalizedException e)
 {
     this.TotalLatency = TestActiveDirectoryConnectivityTask.DefaultFailureTime;
     if (!this.MonitoringContext)
     {
         this.WriteError(e, ErrorCategory.OperationStopped, this, true);
         return;
     }
     this.monitoringData.Events.Add(new MonitoringEvent(TestActiveDirectoryConnectivityTask.CmdletMonitoringEventSource, 2006, EventTypeEnumeration.Error, Strings.ActiveDirectoryConnectivityExceptionThrown(e.ToString())));
 }
コード例 #8
0
        public static LocalizedException TranslateMapiException(LocalizedString exceptionMessage, LocalizedException exception, StoreSession session, object thisObject, string traceMessage, params object[] traceMessageParameters)
        {
            if (ExTraceGlobals.MapiConnectivityTracer.IsTraceEnabled(TraceType.ErrorTrace) && (exception is MapiExceptionBackupInProgress || exception is MapiExceptionNetworkError || exception is MapiExceptionEndOfSession || exception is MapiExceptionLogonFailed || exception is MapiExceptionExiting || exception is MapiExceptionRpcServerTooBusy || exception is MapiExceptionBusy))
            {
                Guid guid = (session == null) ? Guid.Empty : session.MdbGuid;
                ExTraceGlobals.MapiConnectivityTracer.TraceError((long)((thisObject != null) ? thisObject.GetHashCode() : 0), "MAPI exception: {0}\n\rClient: {1}\n\rServer: {2}\n\rMDB: {3}", new object[]
                {
                    exception.ToString(),
                    (session != null) ? session.ClientInfoString : null,
                    (session != null && !session.IsRemote) ? session.ServerFullyQualifiedDomainName : null,
                    guid
                });
            }
            LocalizedException ex = null;

            if (session != null && session.IsRemote)
            {
                if (exception is MapiExceptionBackupInProgress || exception is MapiExceptionNetworkError || exception is MapiExceptionEndOfSession || exception is MapiExceptionLogonFailed || exception is MapiExceptionExiting || exception is MapiExceptionRpcServerTooBusy || exception is MapiExceptionBusy || exception is MapiExceptionMailboxInTransit || exception is MapiExceptionNotEnoughDisk || exception is MapiExceptionNotEnoughResources || exception is MapiExceptionMdbOffline || exception is MapiExceptionServerPaused || exception is MapiExceptionMailboxDisabled || exception is MapiExceptionAccountDisabled || exception is MapiExceptionWrongMailbox || exception is MapiExceptionCorruptStore || exception is MapiExceptionNoAccess || exception is MapiExceptionNoSupport || exception is MapiExceptionNotAuthorized || exception is MapiExceptionPasswordChangeRequired || exception is MapiExceptionPasswordExpired || exception is MapiExceptionNoMoreConnections || exception is MapiExceptionWrongServer || exception is MapiExceptionSessionLimit || exception is MapiExceptionUnconfigured || exception is MapiExceptionUnknownUser || exception is MapiExceptionCallFailed)
                {
                    MailboxSession mailboxSession = session as MailboxSession;
                    string         text           = mailboxSession.MailboxOwner.MailboxInfo.RemoteIdentity.Value.ToString();
                    string         text2          = exception.ToString();
                    StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_XtcMapiError, text, new object[]
                    {
                        text,
                        text2
                    });
                    ExTraceGlobals.XtcTracer.TraceError <string, string>(0L, "The remote connection threw exception for user {0}. Exception: {1}", text, text2);
                }
            }
            else
            {
                ex = StorageGlobals.CheckHAState(exceptionMessage, exception, session);
            }
            if (ex == null)
            {
                if (exception is MapiExceptionBackupInProgress || exception is MapiExceptionNetworkError || exception is MapiExceptionEndOfSession || exception is MapiExceptionLogonFailed || exception is MapiExceptionExiting)
                {
                    ex = new ConnectionFailedTransientException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionMailboxInTransit)
                {
                    ex = new MailboxInTransitException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionNotEnoughDisk || exception is MapiExceptionNotEnoughResources || exception is MapiExceptionBusy)
                {
                    ex = new ResourcesException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionObjectChanged)
                {
                    ex = new SaveConflictException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionCanNotComplete)
                {
                    ex = new CannotCompleteOperationException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionJetErrorCheckpointDepthTooDeep)
                {
                    ex = new CheckpointTooDeepException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionMdbOffline)
                {
                    ex = new MailboxOfflineException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionVirusScanInProgress)
                {
                    ex = new VirusScanInProgressException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionServerPaused)
                {
                    ex = new ServerPausedException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionSearchEvaluationInProgress)
                {
                    ex = new QueryInProgressException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionGlobalCounterRangeExceeded)
                {
                    ex = new GlobalCounterRangeExceededException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionCorruptMidsetDeleted)
                {
                    ex = new CorruptMidsetDeletedException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionMailboxDisabled || exception is MapiExceptionAccountDisabled || exception is MapiExceptionMailboxSoftDeleted)
                {
                    ex = new AccountDisabledException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionWrongMailbox || exception is MapiExceptionCorruptStore)
                {
                    ex = new ConnectionFailedPermanentException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionNoAccess || exception is MapiExceptionNotAuthorized || exception is MapiExceptionPasswordChangeRequired || exception is MapiExceptionPasswordExpired || exception is MapiExceptionNoCreateRight || exception is MapiExceptionNoCreateSubfolderRight)
                {
                    ex = new AccessDeniedException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionCorruptData)
                {
                    ex = new CorruptDataException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionQuotaExceeded || exception is MapiExceptionNamedPropsQuotaExceeded || exception is MapiExceptionShutoffQuotaExceeded)
                {
                    ex = new QuotaExceededException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionCollision)
                {
                    ex = new ObjectExistedException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionNotFound || exception is MapiExceptionInvalidEntryId || exception is MapiExceptionJetErrorRecordDeleted || exception is MapiExceptionObjectDeleted)
                {
                    ex = new ObjectNotFoundException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionNoMoreConnections)
                {
                    ex = new NoMoreConnectionsException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionPartialCompletion)
                {
                    ex = new PartialCompletionException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionFolderCycle)
                {
                    ex = new FolderCycleException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionWrongServer)
                {
                    ex = new WrongServerException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionIllegalCrossServerConnection)
                {
                    ex = new IllegalCrossServerConnectionException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionInvalidRecipients)
                {
                    ex = new InvalidRecipientsException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionMessageTooBig)
                {
                    ex = new MessageTooBigException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionMaxSubmissionExceeded)
                {
                    ex = new MessageSubmissionExceededException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionMaxAttachmentExceeded)
                {
                    ex = new AttachmentExceededException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionVirusDetected)
                {
                    ex = new VirusDetectedException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionVirusMessageDeleted)
                {
                    ex = new VirusMessageDeletedException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionNotInitialized)
                {
                    ex = new ObjectNotInitializedException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionSendAsDenied)
                {
                    ex = new SendAsDeniedException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionSessionLimit)
                {
                    ex = new TooManyObjectsOpenedException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionJetErrorTooManyOpenTablesAndCleanupTimedOut)
                {
                    ex = new ServerCleanupTimedOutException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionJetErrorInvalidLanguageId)
                {
                    ex = new InvalidFolderLanguageIdException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionEventsDeleted)
                {
                    ex = new EventNotFoundException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionUnconfigured)
                {
                    ex = new MailboxUnavailableException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionUnknownUser)
                {
                    ex = new MailboxUnavailableException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionNoReplicaHere)
                {
                    ex = new NoReplicaHereException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionNoReplicaAvailable)
                {
                    ex = new NoReplicaException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionConditionViolation)
                {
                    ex = new FolderSaveConditionViolationException(exceptionMessage, exception);
                }
                else if (exception is MapiExceptionNoSupport)
                {
                    ex = new NoSupportException(exceptionMessage, exception);
                }
                else if (exception is MapiPermanentException)
                {
                    ex = new StoragePermanentException(exceptionMessage, exception);
                }
                else if (exception is MapiRetryableException)
                {
                    ex = new StorageTransientException(exceptionMessage, exception);
                }
                else
                {
                    if (!(exception is MapiExceptionCallFailed))
                    {
                        throw new ArgumentException("Exception is not of type MapiException");
                    }
                    ex = new StoragePermanentException(exceptionMessage, exception);
                }
            }
            if (ExTraceGlobals.StorageTracer.IsTraceEnabled(TraceType.ErrorTrace))
            {
                string arg = string.Format(traceMessage, traceMessageParameters);
                ExTraceGlobals.StorageTracer.TraceError <string, LocalizedException>((long)((thisObject != null) ? thisObject.GetHashCode() : 0), "{0}. Throwing exception: {1}.", arg, ex);
            }
            return(ex);
        }
コード例 #9
0
        // Token: 0x060015C1 RID: 5569 RVA: 0x00050C28 File Offset: 0x0004EE28
        private void LogCmdletIterationEvent()
        {
            bool flag  = this.context.ExchangeRunspaceConfig == null;
            bool flag2 = VariantConfiguration.InvariantNoFlightingSnapshot.CmdletInfra.WriteEventLogInEnglish.Enabled && (CultureInfo.CurrentUICulture != CmdletLogHelper.DefaultLoggingCulture || CultureInfo.CurrentCulture != CmdletLogHelper.DefaultLoggingCulture);

            object[] array = new object[27];
            array[0] = ((this.context.InvocationInfo != null) ? this.context.InvocationInfo.DisplayName : string.Empty);
            array[1] = ((this.context.InvocationInfo == null) ? null : TaskVerboseStringHelper.FormatUserSpecifiedParameters(this.context.InvocationInfo.UserSpecifiedParameters ?? new PropertyBag()));
            array[2] = (flag ? ((this.context.UserInfo != null && this.context.UserInfo.ExecutingUserId != null) ? this.context.UserInfo.ExecutingUserId.ToString() : string.Empty) : this.context.ExchangeRunspaceConfig.IdentityName);
            array[3] = (flag ? null : this.context.ExchangeRunspaceConfig.LogonUserSid);
            array[4] = null;
            if (!flag)
            {
                SecurityIdentifier securityIdentifier = null;
                this.context.ExchangeRunspaceConfig.TryGetExecutingUserSid(out securityIdentifier);
                array[4] = securityIdentifier;
            }
            array[5] = this.GenerateApplicationString();
            array[6] = CmdletIterationEventModule.processIdAndName;
            array[7] = (flag ? ((this.context.UserInfo != null) ? this.context.UserInfo.CurrentOrganizationId : null) : this.context.ExchangeRunspaceConfig.OrganizationId);
            array[8] = Environment.CurrentManagedThreadId;
            DateTime utcNow = DateTime.UtcNow;

            array[9] = utcNow.Subtract(this.lastDateTimeValue);
            this.lastDateTimeValue = utcNow;
            ADDriverContext threadADContext = ADSessionSettings.GetThreadADContext();

            if (threadADContext == null)
            {
                array[10] = null;
            }
            else
            {
                array[10] = (flag2 ? TaskVerboseStringHelper.GetADServerSettings(null, threadADContext.ServerSettings, CmdletLogHelper.DefaultLoggingCulture) : TaskVerboseStringHelper.GetADServerSettings(null, threadADContext.ServerSettings, null));
            }
            if (this.context.ErrorInfo.HasErrors)
            {
                if (this.context.ErrorInfo.Exception != null)
                {
                    Exception exception = this.context.ErrorInfo.Exception;
                    array[11] = exception;
                    array[12] = this.context.ErrorInfo.ExchangeErrorCategory.Value;
                    if (exception != null && exception.InnerException != null)
                    {
                        array[13] = exception.InnerException;
                    }
                    if (exception is LocalizedException)
                    {
                        array[14] = ((LocalizedException)exception).LocalizedString.StringId;
                        if (!flag2)
                        {
                            goto IL_2DE;
                        }
                        LocalizedException ex             = (LocalizedException)exception;
                        IFormatProvider    formatProvider = ex.FormatProvider;
                        try
                        {
                            ex.FormatProvider = CmdletLogHelper.DefaultLoggingCulture;
                            array[11]         = ex.ToString();
                            goto IL_2DE;
                        }
                        finally
                        {
                            ex.FormatProvider = formatProvider;
                        }
                    }
                    array[14] = "NonLocalizedException";
                }
                else
                {
                    array[11] = "null";
                }
            }
IL_2DE:
            object obj;

            this.context.Items.TryGetValue("Log_AdditionalLogData", out obj);
            array[15] = obj;
            LocalizedString delayedInfo = ThrottlingModule <ResourceThrottlingCallback> .GetDelayedInfo(this.context);

            if (!string.IsNullOrEmpty(delayedInfo))
            {
                array[16] = (flag2 ? delayedInfo.ToString(CmdletLogHelper.DefaultLoggingCulture) : delayedInfo) + ThrottlingModule <ResourceThrottlingCallback> .GetThrottlingInfo(this.context);
            }
            array[17] = SuppressingPiiContext.NeedPiiSuppression;
            this.context.Items.TryGetValue("Log_CmdletProxyInfo", out obj);
            array[18] = obj;
            if (this.context.Items.TryGetValue("Log_ProxiedObjectCount", out obj))
            {
                obj = string.Format("{0} objects execution has been proxied to remote server.", obj);
            }
            array[19] = obj;
            if (this.context.Items.TryGetValue("Log_RequestQueryFilterInGetTasks", out obj))
            {
                array[20] = string.Format("Request Filter used is: {0}", obj);
            }
            if (this.context.Items.TryGetValue("Log_InternalQueryFilterInGetTasks", out obj))
            {
                array[21] = string.Format("Cmdlet Filter used is: {0}", obj);
            }
            array[22] = this.outputObjectCount;
            array[23] = "ActivityId: " + ((ActivityContext.ActivityId != null) ? ActivityContext.ActivityId.Value.ToString() : string.Empty);
            if (!flag && this.context.ExchangeRunspaceConfig != null)
            {
                array[24] = this.context.ExchangeRunspaceConfig.GetRBACInformationSummary();
            }
            if (Constants.IsPowerShellWebService && HttpContext.Current != null && HttpContext.Current.Request != null && HttpContext.Current.Request.Headers != null)
            {
                array[25] = HttpContext.Current.Request.Headers["client-request-id"];
            }
            array[26] = CultureInfo.CurrentUICulture.Name;
            ExEventLog.EventTuple eventInfo;
            if (this.context.ErrorInfo.HasErrors)
            {
                eventInfo = TaskEventLogConstants.Tuple_LogCmdletError;
            }
            else if (this.context.WasCancelled)
            {
                eventInfo = TaskEventLogConstants.Tuple_LogCmdletCancelled;
            }
            else if (this.wasStopped)
            {
                eventInfo = TaskEventLogConstants.Tuple_LogCmdletStopped;
            }
            else
            {
                eventInfo = this.CmdletSuccessEventTuple;
            }
            try
            {
                TaskLogger.LogEvent("All", eventInfo, array);
            }
            catch (ArgumentException ex2)
            {
                if (this.context.CommandShell != null)
                {
                    this.context.CommandShell.WriteWarning(Strings.WarningCannotWriteToEventLog(ex2.ToString()));
                }
            }
        }
コード例 #10
0
 private void HandleException(LocalizedException e)
 {
     if (!this.MonitoringContext)
     {
         this.WriteError(e, ErrorCategory.OperationStopped, this, true);
         return;
     }
     this.monitoringData.Events.Add(new MonitoringEvent(TestGlobalLocatorServiceTask.CmdletMonitoringEventSource, 3006, EventTypeEnumeration.Error, Strings.LiveIdConnectivityExceptionThrown(e.ToString())));
 }
コード例 #11
0
        protected LocalizedString GenerateErrorMessage(TestActiveDirectoryConnectivityTask.ScenarioId scenario, int errorCode, string errorMessage, LocalizedException e)
        {
            string error = errorCode.ToString() + ((errorMessage == null) ? "" : ("(" + errorMessage + ")"));

            return(Strings.ActiveDirectoryConnectivityTestFailed(scenario.ToString(), error, (e == null) ? "<Null>" : e.ToString()));
        }
コード例 #12
0
        // Token: 0x06001606 RID: 5638 RVA: 0x000522DC File Offset: 0x000504DC
        private void OnError(object sender, GenericEventArg <TaskErrorEventArg> genericEventArg)
        {
            if (genericEventArg.Data.ExceptionHandled)
            {
                return;
            }
            Exception exception = genericEventArg.Data.Exception;
            Guid      uniqueId  = this.context.UniqueId;
            Exception ex        = CmdletStaticDataWithUniqueId <Exception> .Get(uniqueId);

            if (ex != null && ex != exception)
            {
                CmdletLogger.SafeAppendGenericError(uniqueId, this.context.Stage.ToString() + ".FromWriteError", ex.ToString(), false);
            }
            bool isUnhandledException = (genericEventArg.Data.IsUnknownException != null) ? genericEventArg.Data.IsUnknownException.Value : TaskHelper.IsTaskUnhandledException(exception);

            CmdletLogger.SafeAppendGenericError(uniqueId, this.context.Stage.ToString(), exception.ToString(), isUnhandledException);
            if (exception is LocalizedException)
            {
                CmdletLogger.SafeAppendGenericError(uniqueId, "ExceptionStringId", ((LocalizedException)exception).LocalizedString.StringId, false);
                if (CmdletLogHelper.NeedConvertLogMessageToUS)
                {
                    LocalizedException ex2            = (LocalizedException)exception;
                    IFormatProvider    formatProvider = ex2.FormatProvider;
                    try
                    {
                        ex2.FormatProvider = CmdletLogHelper.DefaultLoggingCulture;
                        CmdletLogger.SafeAppendGenericError(uniqueId, this.context.Stage.ToString() + "(en-us)", ex2.ToString(), false);
                    }
                    finally
                    {
                        ex2.FormatProvider = formatProvider;
                    }
                }
            }
        }
コード例 #13
0
        internal virtual FolderSaveResult SaveFolderPropertyBag(bool needVersionCheck)
        {
            base.CheckDisposed("SaveFolderPropertyBag");
            base.BindToMapiPropertyBag();
            LocalizedException   ex   = null;
            List <PropertyError> list = new List <PropertyError>();

            try
            {
                if (needVersionCheck)
                {
                    this.SaveFlags |= PropertyBagSaveFlags.SaveFolderPropertyBagConditional;
                }
                else
                {
                    this.SaveFlags &= ~PropertyBagSaveFlags.SaveFolderPropertyBagConditional;
                }
                base.MapiPropertyBag.SaveFlags = this.SaveFlags;
                list.AddRange(base.FlushSetProperties());
            }
            catch (FolderSaveConditionViolationException ex2)
            {
                list.AddRange(this.ConvertSetPropsToErrors(PropertyErrorCode.FolderHasChanged, ServerStrings.ExFolderSetPropsFailed(ex2.ToString())));
                return(new FolderSaveResult(OperationResult.Failed, ex2, list.ToArray()));
            }
            catch (StoragePermanentException ex3)
            {
                ex = ex3;
            }
            catch (StorageTransientException ex4)
            {
                ex = ex4;
            }
            finally
            {
                if (ex != null)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug <LocalizedException>((long)this.GetHashCode(), "FolderPropertyBag::SaveFolderPropertyBag. Exception caught while setting properties. Exception = {0}.", ex);
                    PropertyErrorCode errorCode = (ex is StorageTransientException) ? PropertyErrorCode.TransientMapiCallFailed : PropertyErrorCode.MapiCallFailed;
                    if (ex is ObjectExistedException && base.MemoryPropertyBag.ChangeList.Contains(InternalSchema.DisplayName))
                    {
                        errorCode = PropertyErrorCode.FolderNameConflict;
                    }
                    list.AddRange(this.ConvertSetPropsToErrors(errorCode, ServerStrings.ExFolderSetPropsFailed(ex.ToString())));
                }
            }
            LocalizedException ex5 = null;

            try
            {
                list.AddRange(base.FlushDeleteProperties());
            }
            catch (StoragePermanentException ex6)
            {
                ex5 = ex6;
            }
            catch (StorageTransientException ex7)
            {
                ex5 = ex7;
            }
            finally
            {
                if (ex5 != null)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug <LocalizedException>((long)this.GetHashCode(), "FolderPropertyBag::SaveFolderPropertyBag. Exception caught while deleting properties. Exception = {0}.", ex5);
                    PropertyErrorCode error = (ex5 is StorageTransientException) ? PropertyErrorCode.TransientMapiCallFailed : PropertyErrorCode.MapiCallFailed;
                    foreach (PropertyDefinition propertyDefinition in base.MemoryPropertyBag.DeleteList)
                    {
                        list.Add(new PropertyError(propertyDefinition, error, ServerStrings.ExFolderDeletePropsFailed(ex5.ToString())));
                    }
                }
            }
            try
            {
                base.MapiPropertyBag.SaveChanges(false);
            }
            catch (StoragePermanentException arg)
            {
                ExTraceGlobals.StorageTracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "FolderPropertyBag::SaveFolderPropertyBag. Exception caught when calling MapiFolder.SaveChanges. Exception = {0}.", arg);
                if (this.Session != null && this.Session.IsMoveUser)
                {
                    throw;
                }
            }
            catch (StorageTransientException arg2)
            {
                ExTraceGlobals.StorageTracer.TraceError <StorageTransientException>((long)this.GetHashCode(), "FolderPropertyBag::SaveFolderPropertyBag. Exception caught when calling MapiFolder.SaveChanges. Exception = {0}.", arg2);
                if (this.Session != null && this.Session.IsMoveUser)
                {
                    throw;
                }
            }
            this.Clear();
            if (list.Count == 0)
            {
                return(FolderPropertyBag.SuccessfulSave);
            }
            return(new FolderSaveResult(OperationResult.PartiallySucceeded, ex5 ?? ex, list.ToArray()));
        }