Exemplo n.º 1
0
 internal static PropValue[] ConvertToMapiPropValues(PropertyValue[] propertyValues)
 {
     PropValue[] array = null;
     if (propertyValues != null)
     {
         array = new PropValue[propertyValues.Length];
         for (int i = 0; i < propertyValues.Length; i++)
         {
             array[i] = ConvertHelper.ConvertToMapiPropValue(propertyValues[i]);
         }
     }
     return(array);
 }
        // Token: 0x06000110 RID: 272 RVA: 0x00005E64 File Offset: 0x00004064
        protected override void InternalTaskExecute()
        {
            base.InternalTaskExecute();
            if (this.target == null)
            {
                NspiDispatchTask.NspiTracer.TraceError((long)base.ContextHandle, "Target is null");
                throw new NspiException(NspiStatus.GeneralFailure, "Target is null");
            }
            PropValue mapiPropValue = ConvertHelper.ConvertToMapiPropValue(this.target.Value);

            PropTag[]  mapiPropTags = ConvertHelper.ConvertToMapiPropTags(this.propertyTags);
            PropRowSet mapiRowset   = null;

            base.NspiContextCallWrapper("SeekEntries", () => this.Context.SeekEntries(this.NspiState, mapiPropValue, this.restriction, mapiPropTags, out mapiRowset));
            if (base.Status == NspiStatus.Success)
            {
                this.returnState  = base.NspiState;
                this.returnRowset = ConvertHelper.ConvertFromMapiPropRowSet(mapiRowset, MarshalHelper.GetString8CodePage(base.NspiState));
                base.TraceNspiState();
                NspiDispatchTask.NspiTracer.TraceDebug <int>((long)base.ContextHandle, "Rows returned: {0}", (mapiRowset == null) ? 0 : mapiRowset.Rows.Count);
            }
        }
Exemplo n.º 3
0
        internal static Restriction ConvertToMapiRestriction(Restriction restriction)
        {
            if (restriction == null)
            {
                return(null);
            }
            switch (restriction.RestrictionType)
            {
            case RestrictionType.And:
                return(Restriction.And(ConvertHelper.ConvertToMapiRestrictions(((CompositeRestriction)restriction).ChildRestrictions)));

            case RestrictionType.Or:
                return(Restriction.Or(ConvertHelper.ConvertToMapiRestrictions(((CompositeRestriction)restriction).ChildRestrictions)));

            case RestrictionType.Not:
                return(Restriction.Not(ConvertHelper.ConvertToMapiRestriction(((NotRestriction)restriction).ChildRestriction)));

            case RestrictionType.Content:
            {
                ContentRestriction contentRestriction = restriction as ContentRestriction;
                if (contentRestriction.PropertyValue == null)
                {
                    throw new NspiException(NspiStatus.InvalidParameter, "Null PropertyValue is not valid for ContentRestriction.");
                }
                return(Restriction.Content(ConvertHelper.ConvertToMapiPropTag(contentRestriction.PropertyTag), contentRestriction.PropertyTag.IsMultiValuedProperty, ConvertHelper.ConvertToMapiPropValue(contentRestriction.PropertyValue.Value), (ContentFlags)contentRestriction.FuzzyLevel));
            }

            case RestrictionType.Property:
            {
                PropertyRestriction propertyRestriction = restriction as PropertyRestriction;
                if (propertyRestriction.PropertyValue == null)
                {
                    throw new NspiException(NspiStatus.InvalidParameter, "Null PropertyValue is not valid for PropertyRestriction.");
                }
                return(Restriction.Property(ConvertHelper.ConvertToMapiRelOp(propertyRestriction.RelationOperator), ConvertHelper.ConvertToMapiPropTag(propertyRestriction.PropertyTag), propertyRestriction.PropertyTag.IsMultiValuedProperty, ConvertHelper.ConvertToMapiPropValue(propertyRestriction.PropertyValue.Value)));
            }

            case RestrictionType.CompareProps:
            {
                ComparePropsRestriction comparePropsRestriction = restriction as ComparePropsRestriction;
                return(Restriction.CompareProps(ConvertHelper.ConvertToMapiRelOp(comparePropsRestriction.RelationOperator), ConvertHelper.ConvertToMapiPropTag(comparePropsRestriction.Property1), ConvertHelper.ConvertToMapiPropTag(comparePropsRestriction.Property2)));
            }

            case RestrictionType.BitMask:
            {
                BitMaskRestriction bitMaskRestriction = restriction as BitMaskRestriction;
                return(Restriction.BitMask(ConvertHelper.ConvertToMapiRelBmr(bitMaskRestriction.BitMaskOperator), ConvertHelper.ConvertToMapiPropTag(bitMaskRestriction.PropertyTag), (int)bitMaskRestriction.BitMask));
            }

            case RestrictionType.Size:
            {
                SizeRestriction sizeRestriction = restriction as SizeRestriction;
                return(Restriction.PropertySize(ConvertHelper.ConvertToMapiRelOp(sizeRestriction.RelationOperator), ConvertHelper.ConvertToMapiPropTag(sizeRestriction.PropertyTag), (int)sizeRestriction.Size));
            }

            case RestrictionType.Exists:
            {
                ExistsRestriction existsRestriction = restriction as ExistsRestriction;
                return(Restriction.Exist(ConvertHelper.ConvertToMapiPropTag(existsRestriction.PropertyTag)));
            }

            case RestrictionType.SubRestriction:
            {
                SubRestriction subRestriction = restriction as SubRestriction;
                return(Restriction.Sub(ConvertHelper.ConvertToMapiPropTag(subRestriction.SubRestrictionType), ConvertHelper.ConvertToMapiRestriction(subRestriction.ChildRestriction)));
            }

            default:
                throw new NspiException(NspiStatus.InvalidParameter, string.Format("Invalid restriction type: {0}", restriction));
            }
        }