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); }