Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
        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);
        }