private void TranslatePtag(ref int ptag) { PropTag propTag = (PropTag)ptag; if (!propTag.IsNamedProperty()) { return; } NamedPropMapper.Mapping mapping = this.sourceMapper.ById[propTag.Id()]; if (mapping == null) { MrsTracer.Service.Warning("Proptag 0x{0:X} could not be mapped to a namedprop in the source mailbox, not translating.", new object[] { propTag }); return; } NamedPropMapper.Mapping mapping2 = this.targetMapper.ByNamedProp[mapping.NPData]; if (mapping2 != null) { ptag = (int)PropTagHelper.PropTagFromIdAndType(mapping2.PropId, propTag.ValueType()); return; } MrsTracer.Service.Warning("NamedProp {0} (source ptag 0x{1:X}) could not be mapped in the target mailbox, not translating.", new object[] { mapping.NPData, propTag }); }
protected void GetExtendedProps(FolderRec folderRec, GetFolderRecFlags flags) { MrsTracer.Provider.Function("MapiFolder.GetExtendedProps", new object[0]); if ((flags & GetFolderRecFlags.PromotedProperties) != GetFolderRecFlags.None) { PropValue prop; using (this.Mailbox.RHTracker.Start()) { prop = this.Folder.GetProp(PropTag.PromotedProperties); } if (!prop.IsNull() && !prop.IsError()) { PropTag[] array = PropTagHelper.PropTagArray(prop.GetBytes()); folderRec.SetPromotedProperties(array); MrsTracer.Provider.Debug("Found {0} promoted properties.", new object[] { array.Length }); } else { folderRec.SetPromotedProperties(null); MrsTracer.Provider.Debug("Source server does not support promoted property retrieval.", new object[0]); } } if ((flags & (GetFolderRecFlags.Views | GetFolderRecFlags.Restrictions)) != GetFolderRecFlags.None) { this.Mailbox.GetFolderViewsOrRestrictions(folderRec, flags, this.FolderId); } }
internal static void ResolveAndFilterPropertyValues(NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag, StoreSession storeSession, MapiProp mapiProp, ExTimeZone exTimeZone, PropValue[] mapiPropValues, out NativeStorePropertyDefinition[] propertyDefinitions, out PropTag[] mapiPropTags, out object[] propertyValues) { PropTag[] array = new PropTag[mapiPropValues.Length]; for (int i = 0; i < mapiPropValues.Length; i++) { array[i] = mapiPropValues[i].PropTag; } int num; NativeStorePropertyDefinition[] array2 = PropertyTagCache.Cache.InternalPropertyDefinitionsFromPropTags(typeCheckingFlag, mapiProp, storeSession, array, out num); propertyDefinitions = new NativeStorePropertyDefinition[num]; mapiPropTags = new PropTag[num]; propertyValues = new object[num]; int num2 = 0; for (int j = 0; j < array2.Length; j++) { if (array2[j] != null) { object valueFromPropValue = MapiPropertyBag.GetValueFromPropValue(storeSession, exTimeZone, array2[j], mapiPropValues[j]); propertyDefinitions[num2] = array2[j]; mapiPropTags[num2] = PropTagHelper.PropTagFromIdAndType(array[j].Id(), array2[j].MapiPropertyType); propertyValues[num2] = valueFromPropValue; num2++; } } }
PropTag[] IMailbox.GetIDsFromNames(bool createIfNotExists, NamedPropData[] npda) { MrsTracer.Provider.Function("PstMailbox.IMailbox.GetIDsFromNames", new object[0]); PropTag[] array = new PropTag[npda.Length]; for (int i = 0; i < npda.Length; i++) { ushort num; try { if (npda[i].Kind == 0) { num = this.iPst.ReadIdFromNamedProp(null, (uint)npda[i].Id, npda[i].Guid, createIfNotExists); } else { num = this.iPst.ReadIdFromNamedProp(npda[i].Name, 0U, npda[i].Guid, createIfNotExists); } } catch (PSTExceptionBase innerException) { throw new MailboxReplicationPermanentException(new LocalizedString(this.IPst.FileName), innerException); } array[i] = ((num != 0) ? PropTagHelper.PropTagFromIdAndType((int)num, PropType.Unspecified) : PropTag.Unresolved); } return(array); }
public PropTag MapNamedProp(NamedPropData npData, PropType propType) { NamedPropMapper.Mapping mapping = this.ByNamedProp[npData]; if (mapping != null) { return(PropTagHelper.PropTagFromIdAndType(mapping.PropId, propType)); } return(PropTag.Unresolved); }
internal PropTagKey(PropTag propertyTag) { if (propertyTag.IsApplicationSpecific()) { this.propertyTag = propertyTag; return; } this.propertyTag = PropTagHelper.PropTagFromIdAndType(propertyTag.Id(), PropType.Unspecified); }
private static void ReconstituteProperties(short[] unspecifiedTags, ref ICollection <PropTag> props) { if (unspecifiedTags != null) { List <PropTag> list = new List <PropTag>(); foreach (short propId in unspecifiedTags) { list.Add(PropTagHelper.PropTagFromIdAndType((int)propId, PropType.Unspecified)); } list.AddRange(props); props = list; } }
private static void ChangeStringPropTagTypeToUnicode(ref PropTag propTag) { PropType propType = propTag.ValueType(); int propId = propTag.Id(); if (propType == PropType.AnsiString) { propTag = PropTagHelper.PropTagFromIdAndType(propId, PropType.String); return; } if (propType == PropType.AnsiStringArray) { propTag = PropTagHelper.PropTagFromIdAndType(propId, PropType.StringArray); } }
internal static PropTag NormalizeTag(PropTag tag) { PropType propType = tag.ValueType() & (PropType)(-12289); if (propType == PropType.AnsiString) { propType = ((tag.ValueType() & PropType.MultiValueFlag) | PropType.String); tag = PropTagHelper.PropTagFromIdAndType(tag.Id(), propType); } else { propType = (tag.ValueType() & (PropType)(-8193)); tag = PropTagHelper.PropTagFromIdAndType(tag.Id(), propType); } return(tag); }
// Token: 0x06000E77 RID: 3703 RVA: 0x00045448 File Offset: 0x00043648 public static ADRawEntry ReadUserInformationRecord(ADObjectId id, Guid mdbGuid, Guid mbxGuid, bool createReadOnly, IEnumerable <MbxPropertyDefinition> properties, List <ValidationError> errors) { PropTag[] array = MbxRecipientSession.PropTagsFromProperties(properties); PropValue[] array4; try { if (MbxRecipientSession.storeUserInformationReader != null) { uint[] array2 = array.Cast <uint>().ToArray <uint>(); object[] array3 = MbxRecipientSession.storeUserInformationReader.ReadUserInformation(mdbGuid, mbxGuid, array2); if (array3.Length != array2.Length) { throw new ArgumentException("Number of returned property values doesn't match number of requested properties"); } array4 = new PropValue[array2.Length]; for (int i = 0; i < array4.Length; i++) { if (array3[i] != null) { array4[i] = new PropValue((PropTag)array2[i], array3[i]); } else { array4[i] = new PropValue(PropTagHelper.ConvertToError((PropTag)array2[i]), -2147221233); } } } else { using (ExRpcAdmin exRpcAdminInstance = MbxRecipientSession.GetExRpcAdminInstance()) { array4 = exRpcAdminInstance.ReadUserInfo(mdbGuid, mbxGuid, 0U, array); } } } catch (MapiPermanentException innerException) { throw new ADDriverStoreAccessPermanentException(innerException); } catch (MapiRetryableException innerException2) { throw new ADDriverStoreAccessTransientException(innerException2); } return(MbxRecipientSession.ADRawEntryFromPropValues(id, createReadOnly, array4, properties, errors)); }
private RequestJobNamedPropertySet(MapiStore systemMailbox) { NamedProp[] array = new NamedProp[26]; int num = 0; foreach (NamedPropertyData namedPropertyData in RequestJobNamedPropertySet.npData) { array[num] = new NamedProp(namedPropertyData.NPGuid, namedPropertyData.NPName); num++; } PropTag[] idsFromNames = systemMailbox.GetIDsFromNames(true, array); this.PropTags = new PropTag[28]; num = 0; foreach (NamedPropertyData namedPropertyData2 in RequestJobNamedPropertySet.npData) { this.PropTags[num] = PropTagHelper.PropTagFromIdAndType(idsFromNames[num].Id(), namedPropertyData2.NPType); num++; } this.PropTags[26] = PropTag.ReplyTemplateID; this.PropTags[27] = PropTag.EntryId; }
private PropTag GetPropertyTagFromNamedProperty(NamedPropertyDefinition propertyDefinition) { NamedProp namedProp = propertyDefinition.GetKey().NamedProp; NamedPropMap namedPropertyMap = this.parent.NamedPropertyMap; ushort num; if (!namedPropertyMap.TryGetPropIdFromNamedProp(namedProp, out num) && (!this.parent.ResolveAllNamedProperties(this.currentIndex) || !namedPropertyMap.TryGetPropIdFromNamedProp(namedProp, out num))) { num = 0; } if (num != 0) { return(PropTagHelper.PropTagFromIdAndType((int)num, propertyDefinition.MapiPropertyType)); } if (!this.parent.storeSession.Capabilities.IsReadOnly && (!this.parent.allowUnresolvedHeaders || namedProp.Guid != WellKnownPropertySet.InternetHeaders || (namedProp.Guid == WellKnownPropertySet.InternetHeaders && PropertyDefinitionToPropTagCollection.PromotableInternetHeaders.Contains(namedProp.Name)))) { LocalizedString localizedString = ServerStrings.ExInvalidNamedProperty(propertyDefinition.ToString()); ExTraceGlobals.StorageTracer.TraceError(0L, localizedString); throw new StoragePermanentException(localizedString); } return(PropTag.Unresolved); }
protected override NamedPropMapper.Mapping[] LookupKeys(int[] keys) { PropTag[] array = new PropTag[keys.Length]; for (int i = 0; i < keys.Length; i++) { array[i] = PropTagHelper.PropTagFromIdAndType(keys[i], PropType.Unspecified); } NamedPropData[] namesFromIDs = ((NamedPropMapper)base.Owner).mailbox.GetNamesFromIDs(array); NamedPropMapper.Mapping[] array2 = new NamedPropMapper.Mapping[namesFromIDs.Length]; for (int j = 0; j < array.Length; j++) { if (namesFromIDs[j] == null) { array2[j] = null; } else { array2[j] = new NamedPropMapper.Mapping(keys[j], namesFromIDs[j]); } } return(array2); }
internal static PropTag GetMultiValuePropTag(PropTag tag) { return(PropTagHelper.PropTagFromIdAndType(tag.Id(), tag.ValueType() | PropType.MultiValueFlag)); }
private static NspiPropertyDefinition CreatePropertyDefinition(ADSchemaAttributeObject mapiAttribute) { ADPropertyDefinitionFlags adpropertyDefinitionFlags = ADPropertyDefinitionFlags.None; Type typeFromHandle; PropType propType; object defaultValue; switch (mapiAttribute.DataSyntax) { case DataSyntax.Boolean: typeFromHandle = typeof(bool); propType = PropType.Boolean; defaultValue = false; goto IL_13B; case DataSyntax.Integer: case DataSyntax.Enumeration: case DataSyntax.LargeInteger: typeFromHandle = typeof(int); propType = PropType.Int; defaultValue = 0; adpropertyDefinitionFlags |= ADPropertyDefinitionFlags.PersistDefaultValue; goto IL_13B; case DataSyntax.Sid: case DataSyntax.Octet: typeFromHandle = typeof(byte[]); propType = PropType.Binary; defaultValue = null; adpropertyDefinitionFlags |= ADPropertyDefinitionFlags.Binary; goto IL_13B; case DataSyntax.Numeric: case DataSyntax.Printable: case DataSyntax.Teletex: case DataSyntax.IA5: case DataSyntax.CaseSensitive: case DataSyntax.Unicode: typeFromHandle = typeof(string); propType = PropType.String; defaultValue = string.Empty; goto IL_13B; case DataSyntax.UTCTime: case DataSyntax.GeneralizedTime: typeFromHandle = typeof(DateTime?); propType = PropType.SysTime; defaultValue = null; goto IL_13B; case DataSyntax.DNBinary: case DataSyntax.DNString: case DataSyntax.DSDN: case DataSyntax.ORName: typeFromHandle = typeof(ADObjectId); defaultValue = null; if (mapiAttribute.LinkID == 0) { propType = PropType.String; goto IL_13B; } propType = PropType.Object; if (mapiAttribute.LinkID % 2 == 1) { adpropertyDefinitionFlags |= ADPropertyDefinitionFlags.BackLink; goto IL_13B; } goto IL_13B; } NspiSchemaProperties.Tracer.TraceDebug <DataSyntax>(0L, "Unsupported DataSyntax {0} -- Skipped", mapiAttribute.DataSyntax); return(null); IL_13B: if (!mapiAttribute.IsSingleValued) { PropType propType2 = propType; if (propType2 > PropType.Object) { if (propType2 != PropType.String) { if (propType2 == PropType.SysTime) { goto IL_188; } if (propType2 != PropType.Binary) { goto IL_19C; } } propType |= PropType.MultiValueFlag; goto IL_1A7; } if (propType2 != PropType.Int) { switch (propType2) { case PropType.Boolean: break; case (PropType)12: goto IL_19C; case PropType.Object: goto IL_1A7; default: goto IL_19C; } } IL_188: NspiSchemaProperties.Tracer.TraceDebug <PropType>(0L, "Unsupported multivalue property type {0} -- Skipped", propType); return(null); IL_19C: throw new InvalidOperationException("Invalid PropType"); IL_1A7: defaultValue = null; adpropertyDefinitionFlags |= ADPropertyDefinitionFlags.MultiValued; adpropertyDefinitionFlags &= ~ADPropertyDefinitionFlags.PersistDefaultValue; } return(new NspiPropertyDefinition(PropTagHelper.PropTagFromIdAndType(mapiAttribute.MapiID, propType), typeFromHandle, mapiAttribute.LdapDisplayName, adpropertyDefinitionFlags, defaultValue, mapiAttribute.IsMemberOfPartialAttributeSet)); }
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); }
internal static PropTag GetSingleValuePropTag(PropTag tag) { return(PropTagHelper.PropTagFromIdAndType(tag.Id(), tag.ValueType() & (PropType)(-12289))); }