コード例 #1
0
        public PropertyBag[] QueryAttachmentTable(NativeStorePropertyDefinition[] properties)
        {
            this.CheckDisposed(null);
            if (this.savedAttachmentList.Count == 0)
            {
                return(null);
            }
            Dictionary <StorePropertyDefinition, int> propertyPositionsDictionary = QueryResultPropertyBag.CreatePropertyPositionsDictionary(properties);

            PropertyBag[] array = new PropertyBag[this.savedAttachmentList.Count];
            int           num   = 0;

            foreach (KeyValuePair <int, PersistablePropertyBag> keyValuePair in this.savedAttachmentList)
            {
                keyValuePair.Value[AttachmentSchema.AttachNum] = keyValuePair.Key;
                object[] array2 = new object[properties.Length];
                for (int num2 = 0; num2 != properties.Length; num2++)
                {
                    NativeStorePropertyDefinition propertyDefinition = properties[num2];
                    array2[num2] = ((IDirectPropertyBag)keyValuePair.Value).GetValue(propertyDefinition);
                }
                QueryResultPropertyBag queryResultPropertyBag = new QueryResultPropertyBag(null, propertyPositionsDictionary);
                queryResultPropertyBag.ExTimeZone = this.ExTimeZone;
                queryResultPropertyBag.ReturnErrorsOnTruncatedProperties = true;
                queryResultPropertyBag.SetQueryResultRow(array2);
                array[num++] = queryResultPropertyBag;
            }
            return(array);
        }
コード例 #2
0
 public QueryResultPropertyBag(StoreSession session, ICollection <PropertyDefinition> columns)
 {
     this.Context.Session = session;
     if (session != null)
     {
         this.ExTimeZone = session.ExTimeZone;
     }
     this.currentRowValues = null;
     this.returnErrorsOnTruncatedProperties = false;
     this.propertyPositions = QueryResultPropertyBag.CreatePropertyPositionsDictionary(columns);
 }
コード例 #3
0
        public PropertyBag[] QueryAttachmentTable(NativeStorePropertyDefinition[] properties)
        {
            PropValue[][] array     = null;
            MapiTable     mapiTable = null;
            StoreSession  session   = this.AttachmentCollection.ContainerItem.Session;
            bool          flag      = false;

            try
            {
                if (session != null)
                {
                    session.BeginMapiCall();
                    session.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                mapiTable = this.AttachmentCollection.ContainerItem.MapiMessage.GetAttachmentTable();
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetAttachmentTable, ex, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("MapiAttachmentProvider::QueryAttachmentTable", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetAttachmentTable, ex2, session, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("MapiAttachmentProvider::QueryAttachmentTable", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (session != null)
                    {
                        session.EndMapiCall();
                        if (flag)
                        {
                            session.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            using (mapiTable)
            {
                ICollection <PropTag> propTags = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions(this.AttachmentCollection.ContainerItem.MapiMessage, this.AttachmentCollection.ContainerItem.Session, properties);
                StoreSession          session2 = this.AttachmentCollection.ContainerItem.Session;
                bool flag2 = false;
                try
                {
                    if (session2 != null)
                    {
                        session2.BeginMapiCall();
                        session2.BeginServerHealthCall();
                        flag2 = true;
                    }
                    if (StorageGlobals.MapiTestHookBeforeCall != null)
                    {
                        StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                    }
                    array = mapiTable.QueryAllRows(null, propTags);
                }
                catch (MapiPermanentException ex3)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetAttachmentTable, ex3, session2, this, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("MapiAttachmentProvider::QueryAttachmentTable", new object[0]),
                        ex3
                    });
                }
                catch (MapiRetryableException ex4)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetAttachmentTable, ex4, session2, this, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("MapiAttachmentProvider::QueryAttachmentTable", new object[0]),
                        ex4
                    });
                }
                finally
                {
                    try
                    {
                        if (session2 != null)
                        {
                            session2.EndMapiCall();
                            if (flag2)
                            {
                                session2.EndServerHealthCall();
                            }
                        }
                    }
                    finally
                    {
                        if (StorageGlobals.MapiTestHookAfterCall != null)
                        {
                            StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                        }
                    }
                }
            }
            PropertyBag[] array2 = null;
            if (array != null && array.Length > 0)
            {
                Dictionary <StorePropertyDefinition, int> propertyPositionsDictionary = QueryResultPropertyBag.CreatePropertyPositionsDictionary(properties);
                array2 = new PropertyBag[array.Length];
                for (int num = 0; num != array.Length; num++)
                {
                    QueryResultPropertyBag queryResultPropertyBag = new QueryResultPropertyBag(this.AttachmentCollection.ContainerItem.Session, propertyPositionsDictionary);
                    queryResultPropertyBag.ExTimeZone = this.ExTimeZone;
                    queryResultPropertyBag.ReturnErrorsOnTruncatedProperties = true;
                    queryResultPropertyBag.SetQueryResultRow(array[num]);
                    array2[num] = queryResultPropertyBag;
                }
            }
            return(array2);
        }