/ Forums / Advansys Formativ / Creating Solutions with Formativ / Move an Item to a diffent folder using the MessageID

  • Creator
    Topic
  • #4234
    ML_NetBeh
    Participant

    Hi,

    How can I move an Item to a folder using only the MessageID and the Destination Folder Object.

  • Author
    Replies
  • #7555
    Support 3
    Participant

    See the Object API Message.Move() method to move a message to a destination folder. You can only move the message from the owner Folder.Messages collection. If you don’t have access to the folder object of the message then you need to get the message object using the Account.GetMessage(messageid) method and use the EnclosingFolders properties to get the owner folder.

    The sample code below move the selected message from the Mailbox folder to Cabinet.

    set oMsg = client.clientstate.commandmessage
    call groupwise.account.mailbox.messages.move(oMsg.messageid, groupwise.account.cabinet.messages)
    set oMsg = nothing
    

    Hope this helps.

    Regards,
    Advansys Support

    #7557
    ML_NetBeh
    Participant

    Thanks,

    It helps, I use the following code now:

    Set MoveObj = GroupWise.Account.SentItems.Messages.Move(aMsg.MessageID, aFolderDestID.Messages)

    Because the Original message is not Removed, I added the following code:

    if not MoveObj is nothing then
    Call GroupWise.Account.SentItems.Messages.Remove(aMsg.MessageID)
    end if

    But still the Original is not removed. What goes wrong?

    Regards,
    Richard Willemsen

    #7556
    Support 3
    Participant

    Seems like the Messages.Remove() method do not work if you use the Move method. Interesting to see, the Move method create a link for the Sent items messages. May be the index of the messages collection not refresh once the Move method called. You can use the Message.Delete() method to remove the message. See the sample code below:

    set oMsg = client.clientstate.commandmessage
    call groupwise.account.SentItems.messages.move(oMsg.messageid, groupwise.account.cabinet.messages)
    oMsg.delete
    set oMsg = nothing
    

    Regards,
    Advansys Support

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.