Ejemplo n.º 1
0
        private static NamedProp[] MapiGetNamesFromGuid(StoreSession session, MapiProp mapiProp, Guid guid, bool skipKindString, bool skipKindId)
        {
            GetNamesFromIDsFlags getNamesFromIDsFlags = GetNamesFromIDsFlags.None;

            if (skipKindString)
            {
                getNamesFromIDsFlags |= GetNamesFromIDsFlags.NoStrings;
            }
            if (skipKindId)
            {
                getNamesFromIDsFlags |= GetNamesFromIDsFlags.NoIds;
            }
            object thisObject = null;
            bool   flag       = false;

            NamedProp[] namesFromIDs;
            try
            {
                if (session != null)
                {
                    session.BeginMapiCall();
                    session.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                namesFromIDs = mapiProp.GetNamesFromIDs(guid, getNamesFromIDsFlags);
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetNamedProperties, ex, session, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("PropertyTagCache.MapiResolveTags failed.", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetNamedProperties, ex2, session, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("PropertyTagCache.MapiResolveTags 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(namesFromIDs);
        }
Ejemplo n.º 2
0
        private static NamedProp[] MapiGetNamesFromIds(StoreSession session, MapiProp mapiProp, IList <ushort> propIds)
        {
            PropTag[] array = new PropTag[propIds.Count];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = PropTagHelper.PropTagFromIdAndType((int)propIds[i], PropType.Unspecified);
            }
            object thisObject = null;
            bool   flag       = false;

            NamedProp[] namesFromIDs;
            try
            {
                if (session != null)
                {
                    session.BeginMapiCall();
                    session.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                try
                {
                    namesFromIDs = mapiProp.GetNamesFromIDs(array);
                }
                catch (MapiExceptionArgument innerException)
                {
                    throw new CorruptDataException(ServerStrings.MapiCannotGetNamedProperties, innerException);
                }
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetNamedProperties, ex, session, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("PropertyTagCache.MapiResolveTags failed.", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetNamedProperties, ex2, session, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("PropertyTagCache.MapiResolveTags 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(namesFromIDs);
        }