예제 #1
0
            private void LoadMessageID()
            {
                IEFolder folderFirst =
                    OutlookSession.OpenFolder(_folderFirst.FolderIDs.EntryId, _folderFirst.FolderIDs.StoreId);

                Assert.IsNotNull(folderFirst);
                using ( folderFirst )
                {
                    IEMessages messages = folderFirst.GetMessages();
                    Assert.IsNotNull(messages);
                    using ( messages )
                    {
                        if (messages.GetCount() == 0)
                        {
                            Assert.Fail("Source folder should have at least one message");
                        }
                        if (messages.GetCount() != 1)
                        {
                            Assert.Fail("Source folder should have one message");
                        }
                        IEMessage message = messages.OpenMessage(0);
                        Assert.IsNotNull(message);
                        using ( message )
                        {
                            _messageID = OutlookSession.GetMessageID(message);
                            _recordKey = message.GetBinProp(MAPIConst.PR_RECORD_KEY);
                        }
                    }
                }
                Assert.IsNotNull(_messageID);
            }
예제 #2
0
        [Test]//, Ignore( "Investigating problems on OMNIAMEA-UNIT")]
        public void Test()
        {
            FolderDescriptor folderDescriptor = FolderEnum.SearchFolder("Format");

            Assert.IsNotNull(folderDescriptor);
            IEFolder folder =
                OutlookSession.OpenFolder(folderDescriptor.FolderIDs.EntryId, folderDescriptor.FolderIDs.StoreId);

            Assert.IsNotNull(folder);
            using ( folder )
            {
                IEMessages messages = folder.GetMessages();
                Assert.IsNotNull(messages);
                using ( messages )
                {
                    Assert.AreEqual(1, messages.GetCount());
                    IEMessage mail = messages.OpenMessage(0);
                    Assert.IsNotNull(mail);
                    using ( mail )
                    {
                        MessageBody msgBody = mail.GetRawBodyAsRTF();
                        Assert.AreEqual(MailBodyFormat.PlainTextInRTF, msgBody.Format);
                    }
                }
            }
        }
예제 #3
0
            public bool FolderFetched(FolderDescriptor parent, FolderDescriptor folder, out FolderDescriptor folderTag)
            {
                folderTag = folder;
                IEFolder mapiFolder =
                    OutlookSession.OpenFolder(folder.FolderIDs.EntryId, folder.FolderIDs.StoreId);

                if (mapiFolder != null)
                {
                    using ( mapiFolder )
                    {
                        string name = mapiFolder.GetStringProp(MAPIConst.PR_DISPLAY_NAME);
                        Tracer._Trace(name);
                        string containerClass = mapiFolder.GetStringProp(MAPIConst.PR_CONTAINER_CLASS);
                        containerClass = containerClass;
                        EnumerateMailWithBody(mapiFolder);
                        for (int i = 0; i < 1; ++i)
                        {
                            EnumerateMail(mapiFolder);
                        }
                    }
                }
                if (parent == null)
                {
                    return(true);
                }
                return(true);
            }
예제 #4
0
            private string GetFolderID(string entryID)
            {
                IEFolder folder = OutlookSession.OpenFolder(entryID, _storeID);

                Assert.IsNotNull(folder);
                using ( folder )
                {
                    return(OutlookSession.GetFolderID(folder));
                }
            }
예제 #5
0
        [Test]//, Ignore( "Investigating problems on OMNIAMEA-UNIT")]
        public void GetSetCategories()
        {
            FolderEnum       folderEnum       = FolderEnum.SearchForFolders(new string[] { "TasksTest" });
            FolderDescriptor folderDescriptor = folderEnum.GetFolderDescriptor("TasksTest");

            Assert.IsNotNull(folderDescriptor);
            IEFolder folder =
                OutlookSession.OpenFolder(folderDescriptor.FolderIDs.EntryId, folderDescriptor.FolderIDs.StoreId);

            Assert.IsNotNull(folder);
            using ( folder )
            {
                IEMessages messages = folder.GetMessages();
                Assert.IsNotNull(messages);
                using ( messages )
                {
                    Assert.AreEqual(1, messages.GetCount());
                    IEMessage task = messages.OpenMessage(0);
                    Assert.IsNotNull(task);
                    using ( task )
                    {
                        ArrayList categories = OutlookSession.GetCategories(task);
                        Assert.AreEqual(null, categories);
                        categories = new ArrayList();
                        categories.Add("category1");
                        categories.Add("category2");
                        categories.Add("category3");
                        OutlookSession.SetCategories(task, categories);
                        task.SaveChanges();
                    }
                    task = messages.OpenMessage(0);
                    Assert.IsNotNull(task);
                    using ( task )
                    {
                        ArrayList categories = OutlookSession.GetCategories(task);
                        Assert.AreEqual(3, categories.Count);
                        categories.Remove("category1");
                        categories.Remove("category2");
                        categories.Remove("category3");
                        Assert.AreEqual(0, categories.Count);
                        OutlookSession.SetCategories(task, null);
                        task.SaveChanges();
                    }
                    task = messages.OpenMessage(0);
                    Assert.IsNotNull(task);
                    using ( task )
                    {
                        ArrayList categories = OutlookSession.GetCategories(task);
                        Assert.AreEqual(null, categories);
                    }
                }
            }
        }
예제 #6
0
            private void MoveMessage(FolderDescriptor source, FolderDescriptor destination)
            {
                IEFolder srcFolder =
                    OutlookSession.OpenFolder(source.FolderIDs.EntryId, source.FolderIDs.StoreId);

                Assert.IsNotNull(srcFolder);
                using ( srcFolder )
                {
                    IEFolder destFolder =
                        OutlookSession.OpenFolder(destination.FolderIDs.EntryId, destination.FolderIDs.StoreId);
                    Assert.IsNotNull(destFolder);
                    using ( destFolder )
                    {
                        srcFolder.MoveMessage(_messageID, destFolder);
                    }
                }
            }