/ Forums / Advansys Formativ / Creating Solutions with Formativ / Looking for a search sample

  • Creator
    Topic
  • #3981
    Anonymous

      writing my first applet and looking for some sample code todo a generic search.

      example:
      search mail all folders, subject = “x”

      In the samples I found a lot of usefull stuff, like filters, user interfaces, but no search.

      anyone?
      Thanks,

    • Author
      Replies
    • #6769
      Support 1a
      Participant

        You actually use a filter to perform a find. Here’s a simple example:

        dim iFilter
         dim oMessages
         
         iFilter = "(MAIL) AND (SUBJECT CONTAINS ""test"")"
         set oMessages = groupwise.account.mailbox.messages.find(iFilter)
         msgbox oMessages.count
         
         set oMessages = nothing
        

        Examples of other filter syntaxes include:

        (SUBJECT CONTAINS "Internet") 
        (AUTHOR MATCHES "Ralph Spoilsport") 
        (MESSAGE BEGINSWITH "Now Hear This") 
        (MESSAGE CONTAINS CASE ("Inter*" OR "Intra*") AND ("Test" .. "Plan")) 
        (FROM MATCHES <MY_BOSS, STRING> 
        (TASK) 
        (CREATE_DATE >= YESTERDAY AND CREATE_DATE <= TODAY) 
        (FROM CONTAINS "TJEFFERSON" OR FROM CONTAINS "JADAMS") AND (MESSAGE BEGINSWITH "When in the course" AND CREATE_DATE = 1776/7/4) 
        (DUEEND_DATE <= TOMORROW) 
        (START_DATE >= 2002/2/5 AT 8:00:00) 
        (CREATE_DATE >= THIS_YEAR 31) 
        (<BIRTHDAY, DATE> = THIS_MONTH) 
        (SIZE < 12000) 
        (NUMBER_ACCEPTED = TOTAL_RECIPIENTS) 
        (<TOTAL_EMPLOYEES, NUMERIC> > 50) 
        (PRIORITY = HIGH) 
        (ATTACHMENT_TYPE = OLE) 
        (BOX_TYPE = INCOMING) 
        (APPOINTMENT AND NOT ACCEPTED) 
        (MAIL OR TASK) AND (NOT HIDDEN) 
        

        See the Novell Object API documentation topic on filters for more information

        Advansys Support

        #6771
        Anonymous

          Thanks for the sample, but

          The result of this sample code is a small VBScript dialog with a 0 and an OK button.

          Am I missing something or do I just don’t get it.

          Thanks

          #6767
          Support 1
          Participant

            You will notice that the filter expression in the code sample includes the clause

              (SUBJECT CONTAINS ""test"")

            which limits the search to email messages whose Subject contains the text “test”. 0 (zero) on the VBScript dialog indicates you have no such messages, but you can change this filter expression from “test” to any other text.

            Indeed, as indicated by the examples of other filter syntaxes, you can filter on a range of message properties, as well as Subject.

            Advansys Support

            #6770
            Anonymous

              Understand that I’m looking for the string “test”. Looks like the result 0 has something todo with some beta code of GroupWise SP2 I’m running.

              If I understand correctly the sample code you provided should displays the number of messages found.
              (the result should be a number?, right?

              How can you display the actual messages.

              Thanks

              #6768
              Support 1
              Participant

                I suggest you take a look at Mailbox View, which can be downloaded from Cool Solutions here.

                Mailbox View displays a list of messages in a Formativ Portal, where each item includes basic message properties like Subject, Date and From. In particular, subroutine StoreMessageInList in the source code obtains the relevant properties of a message.

                You will find there is a plentiful supply of example Formativ applets – ready to run solutions – at Cool Solutions and at Formativ Applet Central. These examples are very useful for a Formativ beginner to study.

                In addition, you can study the complete list of message properties and methods at the GroupWise Object API reference here. Note: this is the base Message object; there are specializations (with additional properties & methods) for message types like Mail and Appointment.

                Hope this helps.

                Advansys Support

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