/ Forums / Advansys Formativ / Creating Solutions with Formativ / How to delete a draft message???

  • Creator
    Topic
  • #4147
    GoumJer
    Participant

      Hi,

      I use the following code to generate a new message, based on a original message:



      sub ResendMail (Msg)
      Dim objMail
      Dim objNewMail
      Dim objRecipient

      Set objMail = GroupWise.Account.MailBox.Messages.Add(“GW.MESSAGE.MAIL”, fgwDraft)
      Set objRecipient = objMail.Recipients.Add(GroupWise.Account.Owner.EmailAddress,,0)

      With objMail
      .Priority = fgwNormal
      .FromText = Msg.Sender
      .Subject = strPrefix & ” ” & Msg.Subject
      .BodyText.PlainText = “============= Orginal Message =============” & _
      vbcrlf & vbcrlf & _
      Msg.BodyText
      End With

      Set objNewMail = objMail.Send

      set objNewMail = Nothing
      Set objRecipient = Nothing
      Set objMail = Nothing
      end sub


      After sending the email there is a draft-message left in my ‘deleted-items’ box, which is really confusing doing some sorts and searches.

      How can I delete this draft after sending the mail?

      Thanks,

      Jeroen

    • Author
      Replies
    • #7271
      MA
      Participant

        Delete the draft message after send. Here is the code:

        Set objNewMail = objMail.Send
        objMail.delete

        Hope this helps.

        #7274
        Support 1a
        Participant

          Thanks MA!

          #7272
          GoumJer
          Participant

            MA,

            thanks for your reply.

            Unfortunatly this doesn’t solve my problem. The draft message still is in the deleted items.

            Is there a command which does the same as the <shift><del> keyboard combination (really delete)?

            Thanks,

            Jeroen

            quote:


            Originally posted by MA:
            Delete the draft message after send. Here is the code:

            Set objNewMail = objMail.Send
            _objMail.delete_

            Hope this helps.


            #7273
            MA
            Participant

              I cannot reproduce the same behaviour. The draft message was removed from the deleted items if I call message.delete. I also noticed you create the draft message in the Mailbox folder. I recommend you create the draft message in the Work-In-Progress folder. Try the code below to remove the draft message from trash entries collection. Hope this helps.

              ————————-
              sub ResendMail (Msg)
              Dim objMail
              Dim objNewMail
              Dim objRecipient

              Set objMail = GroupWise.Account.WorkFolder.Messages.Add(“GW.MESSAGE.MAIL”, fgwDraft)
              Set objRecipient = objMail.Recipients.Add(GroupWise.Account.Owner.EmailAddress,,0)

              With objMail
              .Priority = fgwNormal
              .FromText = Msg.Sender
              .Subject = strPrefix & ” ” & Msg.Subject
              .BodyText.PlainText = “============= Orginal Message =============” & _
              vbcrlf & vbcrlf & _
              Msg.BodyText
              End With

              Set objNewMail = objMail.Send

              ‘ Removes from TrashEntries collection.
              set oTrashEntry = Groupwise.account.Trash.TrashEntries.ItemEx(objMail.MessageID)
              if not oTrashEntry is nothing then
              oTrashEntry.Delete
              end if

              set objNewMail = Nothing
              Set objRecipient = Nothing
              Set objMail = Nothing
              ————————-

              quote:


              Originally posted by GoumJer:
              MA,

              thanks for your reply.

              Unfortunatly this doesn’t solve my problem. The draft message still is in the deleted items.

              Is there a command which does the same as the keyboard combination (really delete)?

              Thanks,

              Jeroen


              [This message was edited by Support 1 on August 18, 2005 at 05:08 PM.]

              #7269
              Support 1a
              Participant

                Thanks!

                Advansys Support

                #7270
                GoumJer
                Participant

                  MA,

                  thanks for your suggestion, works fine now without any problem!

                  Regards,

                  Jeroen

                  quote:


                  Originally posted by MA:
                  I cannot reproduce the same behaviour. The draft message was removed from the deleted items if I call message.delete. I also noticed you create the draft message in the Mailbox folder. I recommend you create the draft message in the Work-In-Progress folder. Try the code below to remove the draft message from trash entries collection. Hope this helps.

                  ————————-
                  sub ResendMail (Msg)
                  Dim objMail
                  Dim objNewMail
                  Dim objRecipient

                  Set objMail = GroupWise.Account.WorkFolder.Messages.Add(“GW.MESSAGE.MAIL”, fgwDraft)
                  Set objRecipient = objMail.Recipients.Add(GroupWise.Account.Owner.EmailAddress,,0)

                  With objMail
                  .Priority = fgwNormal
                  .FromText = Msg.Sender
                  .Subject = strPrefix & ” ” & Msg.Subject
                  .BodyText.PlainText = “============= Orginal Message =============” & _
                  vbcrlf & vbcrlf & _
                  Msg.BodyText
                  End With

                  Set objNewMail = objMail.Send

                  ‘ Removes from TrashEntries collection.
                  set oTrashEntry = Groupwise.account.Trash.TrashEntries.ItemEx(objMail.MessageID)
                  if not oTrashEntry is nothing then
                  oTrashEntry.Delete
                  end if

                  set objNewMail = Nothing
                  Set objRecipient = Nothing
                  Set objMail = Nothing
                  ————————-

                  quote:


                  Originally posted by GoumJer:
                  MA,

                  thanks for your reply.

                  Unfortunatly this doesn’t solve my problem. The draft message still is in the deleted items.

                  Is there a command which does the same as the <shift><del> keyboard combination (really delete)?

                  Thanks,

                  Jeroen


                  [This message was edited by Support 1 on August 18, 2005 at 05:08 PM.]


                  #7275
                  Support 1a
                  Participant

                    Great news!

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