/ Forums / Advansys Formativ / Creating Solutions with Formativ / Detect New Message in a Folder

  • Creator
    Topic
  • #4101
    Anonymous

      How can I detect if there is an new Message in a Groupwise Folder.
      I can´t find any example Code.

      Thanks

    • Author
      Replies
    • #7105
      MA
      Participant

        Select a GroupWise folder and try the following code. Hope this helps.

        ‘————————————————————-
        Sub Main(Client, GWEvent)

        dim oFolder
        dim oMessages

        ‘ Get the selected folder
        set oFolder = nothing
        set oFolder = Client.ClientState.SelectedFolder

        if oFolder is nothing then
        exit sub
        end if

        msgbox “Selected folder: ” & oFolder.name

        set oMessages = nothing
        set oMessages = oFolder.messages.find(“(MAIL) AND (BOX_TYPE=INCOMING) AND (NOT READ)”)

        if oMessages is nothing then
        exit sub
        end if

        for each oMsg in oMessages
        msgbox “From: ” & oMsg.fromtext & vbcrlf &_
        “Subject: ” & oMsg.Subject & vbcrlf &_
        “Creation Date: ” & oMsg.CreationDate
        next

        set oMessages = nothing
        set oFolder = nothing

        End Sub
        ‘————————————————————-

        #7104
        Support 1a
        Participant

          Thanks for the suggestion. You could also modify this code to run on the ‘Message Arrival’ event. Instead of the selected folder, you could provide a hard coded folder object. This might be appropriate if you have a rule that moves messages to a folder on arrival.

          Advansys Support

          #7107
          Anonymous

            The Tip with the Message Arrival Event ist good.
            With normal Message Arrive it works fine.

            But what event is it, if i get a new Message in shared folder.

            Thanks

            #7106
            Support 1a
            Participant

              I’m not sure if messages being added to a shared folder are treated the same way as messages that are delivered to your mailbox – GroupWise may see that as being two different things. You would have to try and see if the message arrival event is fired.

              In any case, the on message arrival is the only event that triggers when a message is delivered to your mailbox. If it doesn’t fire, you might need to look at another approach.

              Advansys Support

              #7103
              Anonymous

                I´ve more tested.
                For the user’s, which share a folder with other users, a moved Mail to the shared folder, creates a Message arrival event.

                #7108
                Support 1a
                Participant

                  Thanks for the update.

                  Advansys Support

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