Moving read messages

A

AMP

I am writting an application that reads incoming messages, extracts
required information, this works well but how do I move this message
to a another folder (Completed)

The application is written in Visual Basic.net 2005, using mapi

Private Sub CheckfornewMail()
Dim oApp As Outlook.Application = New Outlook.Application
' Get Mapi NameSpace.

Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
Dim subfolder As Outlook.Folders
oNS.Logon("Username", "Password", False, True)

' Get Messages collection of Inbox.

Dim oInbox As Outlook.MAPIFolder =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)

Dim osItems = CreateObject("Redemption.SafeMailItem")
Dim oItems As Outlook.Items = oInbox.Items.Restrict("[Unread]
= true")

' Get unread e-mail messages.

oItems = oItems.Restrict("[Unread] = true")
' Loop each unread message.
Dim icount As Integer
Dim i As Integer
If IsDBNull(oItems.Count) Then
icount = 0
Else
icount = oItems.Count
End If
'Try
If icount > 0 Then
Me.Timer1.Enabled = False
Else
Me.Timer1.Enabled = True
End If

If icount > 0 Then
For i = icount To 1 Step -1
osItems.Item = oItems.Item(i)

'read required information

'Move to folder "Completed"
???
???
Next
End If

' Clean up.
oApp = Nothing
oNS = Nothing
oItems = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top