Click here to Skip to main content
14,699,081 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,
I had search several days to find a solution for outlook to move some mail from inbox to another folder (I created a folder named "mymailbox").

It is easy to implement by visual basic for microsoft website, such as:

Sub MoveItems()
    Dim myOlApp As New Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myInbox As Outlook.MAPIFolder
    Dim myDestFolder As Outlook.MAPIFolder
    Dim myItems As Outlook.Items
    Dim myItem As Object
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
    Set myItems = myInbox.Items
    Set myDestFolder = myInbox.Folders("Personal Mail")
    Set myItem = myItems.Find("[SenderName] = 'Dan Wilson'")
    While TypeName(myItem) <> "Nothing"
        myItem.Move myDestFolder
        Set myItem = myItems.FindNext
End Sub

but, I can't find the related function in visual c++. such as: _MAPIFolder have not the 'Folders' member function.

If you have some useful clue, please you tell me!
Thanks in advance.

1 solution

Espen Harlinn 10-Jul-11 7:03am
Interesting little article, my 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900