示例#1
0
        public static bool ProcessIMAPMessage(IEFolder folder, string entryID)
        {
            Tracer._Trace("ProcessIMAPMessage");
            IETable table = folder.GetEnumTable(DateTime.MinValue);

            if (table == null)
            {
                return(false);
            }
            using ( table )
            {
                int count = table.GetRowCount();
                if (count > 0)
                {
                    table.Sort(MAPIConst.PR_MESSAGE_DELIVERY_TIME, false);
                }
                for (uint i = 0; i < count; i++)
                {
                    IERowSet row = table.GetNextRow();
                    if (row == null)
                    {
                        continue;
                    }
                    using ( row )
                    {
                        if (row.GetBinProp(0) == entryID)
                        {
                            if (row.GetLongProp(6) == 1)
                            {
                                Tracer._Trace("ProcessIMAPMessage FALSE");
                                //folder.SetMessageStatus( entryID, 0x1000, 0x1000 );
                                return(false);
                            }
                            else
                            {
                                Tracer._Trace("ProcessIMAPMessage TRUE");
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
示例#2
0
            void EnumerateMail(IEFolder mapiFolder)
            {
                IETable table = null;

                try
                {
                    table = mapiFolder.GetEnumTable(DateTime.Now.AddDays(-3));
                }
                catch (System.UnauthorizedAccessException) {}
                if (table == null)
                {
                    return;
                }
                using ( table )
                {
                    int count = table.GetRowCount();
                    if (count > 0)
                    {
                        table.Sort(MAPIConst.PR_MESSAGE_DELIVERY_TIME, false);
                    }
                    for (uint i = 0; i < count; i++)
                    {
                        IERowSet row = table.GetNextRow();
                        if (row == null)
                        {
                            continue;
                        }
                        using ( row )
                        {
                            for (int j = 0; j < 1; ++j)
                            {
                                ProcessRow(row, mapiFolder);
                            }
                        }
                    }
                }
            }
示例#3
0
        private void EnumerateMail(FolderDescriptor folder, IEFolder mapiFolder)
        {
            try
            {
                OnFolderFetched(folder.Name);
                int indexed = 0;

                IResource resFolder  = Folder.Find(folder.FolderIDs.EntryId);
                DateTime  dtRestrict = GetRestrictDate(resFolder);

                IETable table = null;
                try
                {
                    table = mapiFolder.GetEnumTable(dtRestrict);
                }
                catch (System.UnauthorizedAccessException exception)
                {
                    _tracer.TraceException(exception);
                }
                catch (OutOfMemoryException exception)
                {
                    _tracer.TraceException(exception);
                }
                if (table == null)
                {
                    return;
                }
                using ( table )
                {
                    int count = table.GetRowCount();
                    if (count > 0)
                    {
                        table.Sort(MAPIConst.PR_MESSAGE_DELIVERY_TIME, false);
                    }
                    for (uint i = 0; i < count; i++)
                    {
                        if (OutlookSession.OutlookProcessor.ShuttingDown)
                        {
                            break;
                        }
                        if (_idle && Settings.IdleModeManager.CheckInterruptIdle())
                        {
                            break;
                        }
                        IERowSet row = row = table.GetNextRow();
                        if (row == null)
                        {
                            continue;
                        }
                        using ( row )
                        {
                            if (row.GetLongProp(6) != 1)
                            {
                                ProcessRow(row, folder, mapiFolder, ref indexed);
                            }
                        }
                    }
                }
                if (Settings.IdleModeManager.CompletedIdle)
                {
                    Folder.SetSeeAllAsync(resFolder);
                }

                _tracer.Trace("Indexed " + indexed + " messages in folder " + folder.Name);
            }
            finally
            {
                OutlookSession.ProcessJobs();
            }
        }