示例#1
0
        public Dictionary <string, bool> GetMessageStores()
        {
            Dictionary <string, bool> stores = new Dictionary <string, bool>();

            if (session_ == null)
            {
                return(stores);
            }
            IntPtr pTable = IntPtr.Zero;

            session_.GetMsgStoresTable(0, out pTable);
            if (pTable == IntPtr.Zero)
            {
                return(stores);
            }
            object    tableObj = null;
            MAPITable mb       = null;

            try
            {
                tableObj = Marshal.GetObjectForIUnknown(pTable);
                mb       = new MAPITable(tableObj as IMAPITable);
                if (mb != null)
                {
                    if (mb.SetColumns(new PropTags[] { PropTags.PR_DISPLAY_NAME, PropTags.PR_DEFAULT_STORE }))
                    {
                        SRow[] sRows;

                        while (mb.QueryRows(1, out sRows))
                        {
                            if (sRows.Length != 1)
                            {
                                break;
                            }
                            stores[sRows[0].propVals[0].AsString] = sRows[0].propVals[1].AsBool;
                        }
                    }
                    mb.Dispose();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }
            return(stores);
        }
示例#2
0
        public Dictionary<string, bool> GetMessageStores()
        {
            Dictionary<string, bool> stores = new Dictionary<string, bool>();
            if (session_ == null)
                return stores;
            IntPtr pTable = IntPtr.Zero;
            session_.GetMsgStoresTable(0, out pTable);
            if (pTable == IntPtr.Zero)
                return stores;
            object tableObj = null;
            MAPITable mb = null;
            try
            {
                tableObj = Marshal.GetObjectForIUnknown(pTable);
                mb = new MAPITable(tableObj as IMAPITable);
                if (mb != null)
                {
                    if (mb.SetColumns(new PropTags[] { PropTags.PR_DISPLAY_NAME, PropTags.PR_DEFAULT_STORE }))
                    {
                        SRow[] sRows;

                        while (mb.QueryRows(1, out sRows))
                        {
                            if (sRows.Length != 1)
                                break;
                            stores[sRows[0].propVals[0].AsString] = sRows[0].propVals[1].AsBool;
                        }
                    }
                    mb.Dispose();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }
            return stores;
        }