Outlook connectivity

Ki_enzo

New Member
Hi,

Does anyone have any experience with moving outlook emails from Inbox to another sub-folder within Outlook on 6.7?
I am struggling with the 'Move To Folder' function as when i place a parameter of {Inbox, SubFolder} the email does not move.

Thanks
 

Sachin_Kharmale

Active Member
For move mail to another folder use bellow code.
C#:
' Assume success
Success = True
Error_Message = ""
NewID = ""

Try

    ' Verify that all input fields are present
    Dim missingInput As String = Nothing
    ' Save the first empty input name
    Select Case ""
        Case Profile : missingInput = "Profile"
        Case ID : missingInput = "ID"
    End Select
    ' If any were empty, raise the error
    If missingInput IsNot Nothing Then Throw New MAPIException( _
      "{0} input parameter not set", missingInput)

    ' Initialise the extended MAPI interface
    Using mapi As New NetMAPI()

        'log into mapi
        mapi.Login(Profile)

        If Not mapi.OpenMessageStore() Then Throw New MAPIException( _
         "Failed to access message store")

        If Not mapi.OpenInbox() Then Throw New MAPIException( _
         "Failed to access inbox")

        If Move_to_Sub_Folder <> "" Then
            Using msg As BPMAPIMessage = mapi.FindMessage(ID)
                msg.MoveMessageTo(mapi, Move_to_Sub_Folder, Folder_Separator)
                NewID = msg.ID
            End Using
        End If
    End Using

Catch mex As MAPIException
    Success = False
    Error_Message = mex.GetActionMessage("Move Mail")

Catch e As Exception
    Success = False
    Error_Message = e.ToString()
End Try
Give proper sub folder name as a input.
 
Top