private static void FindWellKnownFolders(IMailbox mailbox, PropTagFolderMapping[] map, FolderHierarchyUtils.GetPropsDelegate getProps, Dictionary <WellKnownFolderType, byte[]> wellKnownFolders) { NamedPropMapper namedPropMapper = CommonUtils.CreateNamedPropMapper(mailbox); PropTag[] array = new PropTag[map.Length]; for (int i = 0; i < map.Length; i++) { InboxNamedPropFolderMapping inboxNamedPropFolderMapping = map[i] as InboxNamedPropFolderMapping; if (inboxNamedPropFolderMapping != null) { namedPropMapper.ByNamedProp.AddKey(inboxNamedPropFolderMapping.NamedPropData); } } for (int j = 0; j < map.Length; j++) { InboxNamedPropFolderMapping inboxNamedPropFolderMapping2 = map[j] as InboxNamedPropFolderMapping; if (inboxNamedPropFolderMapping2 != null) { array[j] = namedPropMapper.MapNamedProp(inboxNamedPropFolderMapping2.NamedPropData, PropType.Binary); } else { array[j] = map[j].Ptag; } } PropValueData[] a = getProps(array); PropValue[] native = DataConverter <PropValueConverter, PropValue, PropValueData> .GetNative(a); for (int k = 0; k < map.Length; k++) { byte[] array2 = null; if (!native[k].IsNull() && !native[k].IsError()) { InboxIndexedFolderMapping inboxIndexedFolderMapping = map[k] as InboxIndexedFolderMapping; if (inboxIndexedFolderMapping == null) { array2 = native[k].GetBytes(); } else { byte[][] bytesArray = native[k].GetBytesArray(); if (bytesArray != null && bytesArray.Length > inboxIndexedFolderMapping.EntryIndex) { array2 = bytesArray[inboxIndexedFolderMapping.EntryIndex]; } else { array2 = null; } } } if (array2 != null) { wellKnownFolders[map[k].WKFType] = array2; } } }
private void WriteEntryIdReference(PropTagFolderMapping ptfm, byte[] folderId, FolderHierarchy.GetPropsDelegate getProps, FolderHierarchy.SetPropsDelegate setProps) { InboxNamedPropFolderMapping inboxNamedPropFolderMapping = ptfm as InboxNamedPropFolderMapping; PropTag propTag; if (inboxNamedPropFolderMapping != null) { propTag = this.MbxWrapper.NamedPropMapper.MapNamedProp(inboxNamedPropFolderMapping.NamedPropData, PropType.Binary); } else { propTag = ptfm.Ptag; } MrsTracer.Service.Debug("Writing WKF reference {0}: {1} -> {2}", new object[] { ptfm.WKFType, propTag, TraceUtils.DumpEntryId(folderId) }); InboxIndexedFolderMapping inboxIndexedFolderMapping = ptfm as InboxIndexedFolderMapping; object value; if (inboxIndexedFolderMapping != null) { List <byte[]> list = new List <byte[]>(); PropValueData[] array = getProps(new PropTag[] { propTag }); byte[][] array2 = array[0].Value as byte[][]; if (array2 != null) { list.AddRange(array2); } while (list.Count < inboxIndexedFolderMapping.EntryIndex + 1) { list.Add(Array <byte> .Empty); } list[inboxIndexedFolderMapping.EntryIndex] = folderId; value = list.ToArray(); } else { value = folderId; } PropValueData[] pvda = new PropValueData[] { new PropValueData(propTag, value) }; setProps(pvda); }
internal static List <PropTag> GetInboxReferencePtags(NamedPropMapper namedPropMapper, int?mailboxVersion) { List <PropTag> list = new List <PropTag>(); foreach (InboxFolderMapping inboxFolderMapping in FolderHierarchyUtils.InboxRefs) { InboxNamedPropFolderMapping inboxNamedPropFolderMapping = inboxFolderMapping as InboxNamedPropFolderMapping; if (inboxNamedPropFolderMapping != null) { list.Add(namedPropMapper.MapNamedProp(inboxNamedPropFolderMapping.NamedPropData, PropType.Binary)); } else { list.Add(inboxFolderMapping.Ptag); } } if (mailboxVersion == null || mailboxVersion.Value < Server.E14SP1MinVersion) { list.Add((PropTag)907804930U); } list.Add((PropTag)920191234U); return(list); }