• Creator
    Topic
  • #3934
    rfaude
    Participant

    Hi,

    i look for a sample which check if a mail is actual OPEN (not selected) and a type of MAIL. If this conditions are true show a messagebox.

    Thanks for help

    Best Regards

    Ralf

  • Author
    Replies
  • #6643
    Support 1a
    Participant

    I should be able to provide some sample code. However, if the message you wish to query is not the selected message, what technique are you using to identify the message you wish to query the status of? Do you have the message ID?

    Here’s some sample code, but I’m not sure if this does what you need:

    dim iMsgID
      
      ' Returns the message ID of the active view. 
      iMsgID = GroupWise.ItemMessageIDFromView()
      
      ' Make sure the token didn't fail
      if (instr(1, iMsgID, "Token failed execution", 1) <> 0) or (len(iMsgID) = 0) then
        call msgbox("Unable to find a message view.  Please execute this applet from a message toolbar.")  
        exit sub
      end if      
          
      ' Returns an item's type. 
      if (groupwise.ItemGetType(iMsgID) = 2) then
        msgbox "Mail message view open."
      end if
    

    If this doesn’t help, please provide a little more information.

    Thanks,

    Advansys Support

    #6646
    rfaude
    Participant

    Hi,

    ok i try to explain with more details.

    The basic function of the applet is to start a UI to create a task. The fields to insert information for example
    Subject, Bodytext are empty. This works fine. Now i want to enhance the applet with following functionality:
    When i start the applet inside a mail which is currently active (viewed) read the subject and the bodytext, start the
    UI and insert the subject and bodytext into the fields. With the code below i can determine what type of message it is (if i am right), but i cannot check the status of the mail if it is currently active (viewed). Only when it is currently active it should read the subject and bodytext to insert it, else open a empty UI.

    ‘ If Type = Mail read Subject and Bodytext
    Set SourceMsg = Client.ClientState.CommandMessage

    if (SourceMsg.Classname = “GW.MESSAGE.MAIL”) then
    SourceSubject = SourceMsg.Subject
    SourceBodytext = SourceMsg.Bodytext
    end if

    Thanks again for help.

    Best Regards

    Ralf

    #6642
    Support 1a
    Participant

    Hi Ralf,

    If I understand correctly, you need to determine if the message returned by the Client.ClientState.CommandMessage is currently opened, or close (i.e. just selected in the message list).

    If this is correct, then I think you need to use some variation on the code from our previous post to determine if the command message ID is the same as the ID returned from ItemMessageIDFromView().

    In other words, in addition to obtaining the CommandMessage object, call ItemMessageIDFromView(), and check that the command succeeds. If it does (which means a message view is opened), compare the message ID returned against the message ID from the CommandMessage as a double check you are using the correct message. Alternatively, you could just use the ItemGetText() methods using the message ID returned from ItemMessageIDFromView() to extract the subject and body from the currently opened view.

    I hope this helps.

    Advansys Support

    #6641
    rfaude
    Participant

    Yeppie,

    it works. Thanks.
    But where can i find the values which returns from groupwise.ItemGetType. I looked into the language guide but there are no values described.

    Best Regards

    Ralf

    #6644
    Support 1a
    Participant

    ItemGetType returns the following integer values:

    1 Appointment
    2 Mail
    3 Note
    4 Phone Message
    5 Task

    Regards,

    Advansys Support

    #6645
    rfaude
    Participant

    Thanks.

    Ralf

    #6647
    Support 1a
    Participant

    You are welcome Ralf!

    Advansys Support

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