• Creator
    Topic
  • #3860
    Gem.Rhenen
    Participant

      Listed the script I combined to get an orginal message to one single recipient. The message arives, but the attachment is not there.

      Who can help.

      Thanks



      ‘ Insert your comments here


      Sub Main(Client, GWEvent)

      Dim objDraft
      Dim objEmail
      Dim objRecipient
      Dim Archief
      Dim MessagesID(1)

      ‘ Create a draft email message
      Set objDraft = GroupWise.Account.MailBox.Messages.Add(4)

      ‘ Add a single recipient test@test.com
      Archief = “test@test.com”
      objRecipient = objDraft.Recipients.Add(Archief,,0)

      ‘ Add some properties
      Set Msg = Client.ClientState.CommandMessage
      MessagesID(1)= Msg.MessageID

      objDraft.Subject = “Please Reply”
      objDraft.BodyText.PlainText = “Please send reply to this message.”
      Call GroupWise.ItemAttachmentAdd(“X00″,115,MessagesID(1),”Test”)

      ‘ Send the email by calling the send method
      Set objEmail = objDraft.Send

      ‘ Display the message ID
      MsgBox(“Thank You”)

      End Sub

    • Author
      Replies
    • #6429
      Support 2
      Moderator

        The problem appears to be that you are using Object API commands to build most of the message but then you are using a Token command, Call GroupWise.ItemAttachmentAdd(“X00″,115,MessagesID(1),”Test”), to add the attachment.

        Unfortunately you cannot mix the types of API commands in this manner. Instead you would use the Object API command to add the attachment. For example, to add a file ‘c:test.txt’ to the message, you would use:

        call objDraft.Attachments.Add(“c:test.txt”, fgwFile, “Test”)

        To add an existing message, you use:

        call objMail.Attachments.Add(Msg, “Description”)

        I hope this helps.

        Regards,

        Advansys Support

        #6428
        Gem.Rhenen
        Participant

          ‘——————————————————————————-
          ‘ Insert your comments here
          ‘——————————————————————————-

          Sub Main(Client, GWEvent)
          Dim objDraft
          Dim objEmail
          Dim objRecipient
          Dim Archief

          ‘ Maak een nieuw bericht
          Set objDraft = GoupWise.Account.MailBox.Messages.Add(4)

          ‘ Voeg een ontvanger in
          Archief = “test@test.com
          objRecipient = objDraft.Recipients.Add(Archief,,0)

          ‘ Voeg parameters toe
          Set Msg = Client.ClientState.CommandMessage

          objDraft.Subject = “Archivering gewenst”
          objDraft.BodyText.PlainText = “Graag dit bericht archiveren.”

          ‘ call objDraft.Attachments.Add(Msg, “Test”)

          ‘ Verstuur het bericht dmv de verzend methode
          Set objEmail = objDraft.Send

          ‘ Verzend bevestiging
          Call MsgBox(“Dank U.”, 64, “Bericht verzonden.”)
          End Sub

          =============================================
          In this case the message is generated, and send to the recipient, as soon as I enable the attachment line (call objDraft.Attachments.Add(Msg, “Test”)) the message is not send, but comes back into my own mailbox as a draft without recipient. Can you please provide me with a working script to attach the original message and send it to a single recipient (in this case test@test.com).

          An other problem I have is that: when I do not have a message selected it fails on the following line:

          Set Msg = Client.ClientState.CommandMessage

          How can I check if there is a message selected?

          Thanks already for your help so far.

          #6432
          Support 1a
          Participant

            There are a couple of ways to do this. Here are two examples:

            Example 1:
            This example using native Object API calls. Notice that we do a forward in order to build a new message with the original attached. We then fill out the appropriate information in the new draft forward. We have found this is the most reliable way to attach a message object to a new message.

            '-------------------------------------------------------------------------------
            ' Create a message and attach the selected message through using the Object API
            '-------------------------------------------------------------------------------

            Sub Main(Client, GWEvent)

            Dim objDraft
            Dim objEmail
            Dim objRecipient
            Dim Archief

            ' Voeg parameters toe
            On Error Resume Next
            Set Msg = Client.ClientState.CommandMessage

            set objDraft = Msg.Forward

            with objDraft
            call .Recipients.Add(GroupWise.Account.Owner.EmailAddress, ,0)
            .Subject = "Test"
            .BodyText = "Body text"
            end with

            ' Verstuur het bericht dmv de verzend methode
            Set objEmail = objDraft.Send

            ' Verzend bevestiging
            Call MsgBox("Dank U.", 64, "Bericht verzonden.")

            End Sub

            Example 2:

            '-------------------------------------------------------------------------------
            ' Create a new message and attach the selected message using token commands.
            '-------------------------------------------------------------------------------
            Sub Main(Client, GWEvent)

            ' Check to see whether we have selected any messages
            On Error Resume Next
            Set Msg = Client.ClientState.CommandMessage
            if isobject(Msg) then
            MsgID = Msg.MessageID
            end if

            Archief = GroupWise.Account.Owner.EmailAddress

            'Create a new Mail
            GroupWise.NewMail
            Set NewMsg = GroupWise.ComposingItem
            with NewMsg
            .To_ = Archief
            .Subject = "Archivering gewenst"
            .BodyText = "Graag dit bericht archiveren."
            end with

            ' Attached the selected message
            if MsgID <> "" then
            call GroupWise.ItemAttachmentAdd("X00", itcAttachClassMessage, Msg.MessageID, "")
            end if

            GroupWise.ItemSend(0)

            set Msg = nothing
            set NewMsg = nothing

            End Sub

            You will notice that we check for the existence of a return value from Client.ClientState.CommandMessage
            using a combination of both On Error Resume Next and the IsObject() function.

            I hope this information helps.

            Advansys Support

            #6430
            Gem.Rhenen
            Participant

              It works fine now, thanks for your support. You can look forward to an order for 100 more clients.

              #6431
              Support 2
              Moderator

                Thanks for the feedback!

                Just let us know if you have any further questions.

                Regards,

                Advansys Support

                #6433
                Gem.Rhenen
                Participant

                  If I use the same script “on send”, the composed message is to be forwarded to “ARCHIVE@test.com”. Unfortunatly this is not working as of now. Please provide sample script for this, or a mod. on the existing script.

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