コード例 #1
0
        internal ImportResult ImportMove(byte[] sourceParentSourceKey, byte[] sourceSourceKey, byte[] sourcePredecessorChangeList, byte[] destinationSourceKey, byte[] destinationChangeKey)
        {
            this.CheckDisposed(null);
            StoreSession        session = base.Session;
            bool                flag    = false;
            MapiCollectorStatus mapiCollectorStatus;

            try
            {
                if (session != null)
                {
                    session.BeginMapiCall();
                    session.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                mapiCollectorStatus = base.MapiCollector.ImportMessageMove(new PropValue(PropTag.ParentSourceKey, sourceParentSourceKey), new PropValue(PropTag.SourceKey, sourceSourceKey), new PropValue(PropTag.PredecessorChangeList, sourcePredecessorChangeList), new PropValue(PropTag.SourceKey, destinationSourceKey), new PropValue(PropTag.ChangeKey, destinationChangeKey));
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.CannotImportMessageMove, ex, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("Import of the message move failed", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.CannotImportMessageMove, ex2, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("Import of the message move failed", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (session != null)
                    {
                        session.EndMapiCall();
                        if (flag)
                        {
                            session.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            return(ContentsSynchronizationUploadContext.ConvertToImportResult(mapiCollectorStatus));
        }
コード例 #2
0
        internal void ThrowOnImportResult(ImportResult result)
        {
            StoreSession session = base.Session;
            bool         flag    = false;

            try
            {
                if (session != null)
                {
                    session.BeginMapiCall();
                    session.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                base.MapiCollector.ThrowOnCollectorStatus(ContentsSynchronizationUploadContext.ConvertToCollectorStatus(result));
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.ImportResultContainedFailure, ex, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("ImportResult contained a failure", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.ImportResultContainedFailure, ex2, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("ImportResult contained a failure", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (session != null)
                    {
                        session.EndMapiCall();
                        if (flag)
                        {
                            session.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
        }
コード例 #3
0
        internal ImportResult ImportChange(CreateMessageType createMessageType, bool failOnConflict, IList <PropertyDefinition> propertyDefinitions, IList <object> propertyValues, out MapiMessage mapiMessage)
        {
            this.CheckDisposed(null);
            ImportMessageChangeFlags importMessageChangeFlags = ImportMessageChangeFlags.NewMessage;

            if (failOnConflict)
            {
                importMessageChangeFlags |= ImportMessageChangeFlags.FailOnConflict;
            }
            if (createMessageType == CreateMessageType.Associated)
            {
                importMessageChangeFlags |= ImportMessageChangeFlags.Associated;
            }
            else if (createMessageType != CreateMessageType.Normal)
            {
                throw new ArgumentOutOfRangeException("createMessageType", createMessageType, "Only Normal and Associated messages can be imported");
            }
            PropValue[]  propValues   = base.GetPropValuesFromValues(base.Session.ExTimeZone, propertyDefinitions, propertyValues).ToArray();
            MapiMessage  mapiMessage2 = null;
            bool         flag         = false;
            ImportResult result;

            try
            {
                StoreSession        session = base.Session;
                bool                flag2   = false;
                MapiCollectorStatus mapiCollectorStatus;
                try
                {
                    if (session != null)
                    {
                        session.BeginMapiCall();
                        session.BeginServerHealthCall();
                        flag2 = true;
                    }
                    if (StorageGlobals.MapiTestHookBeforeCall != null)
                    {
                        StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                    }
                    mapiCollectorStatus = base.MapiCollector.ImportMessageChange(propValues, importMessageChangeFlags, out mapiMessage2);
                }
                catch (MapiPermanentException ex)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.CannotImportMessageChange, ex, session, this, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("Import of the message change failed", new object[0]),
                        ex
                    });
                }
                catch (MapiRetryableException ex2)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.CannotImportMessageChange, ex2, session, this, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("Import of the message change failed", new object[0]),
                        ex2
                    });
                }
                finally
                {
                    try
                    {
                        if (session != null)
                        {
                            session.EndMapiCall();
                            if (flag2)
                            {
                                session.EndServerHealthCall();
                            }
                        }
                    }
                    finally
                    {
                        if (StorageGlobals.MapiTestHookAfterCall != null)
                        {
                            StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                        }
                    }
                }
                ImportResult importResult = ContentsSynchronizationUploadContext.ConvertToImportResult(mapiCollectorStatus);
                mapiMessage = mapiMessage2;
                flag        = true;
                result      = importResult;
            }
            finally
            {
                if (!flag)
                {
                    mapiMessage = null;
                    if (mapiMessage2 != null)
                    {
                        mapiMessage2.Dispose();
                    }
                }
            }
            return(result);
        }