#6857
Support 1
Participant

    You can find documentation on the Query object here. Novell’s Object API reference also includes Filter Expressions.

    The example applet in my earlier post limits the search to the Mailbox folder (see the Query.Locations property).

    The folder object does not have a ‘sort by’ property. However you can create a Display Settings profile for this folder. On the main GroupWise menu: View | Display Settings > Edit/Create. Sort by date is among the many options available here. I think the administrator also can create a profile which can be shared by multiple users.

    The following example applet applies the predefined profile ‘Test’ to the search folder ‘Unopened Items’.

    const FOLDER_NAME_QUERY = "Unopened Items"
    const SETTINGS_NAME = "Test"
    
    '-------------------------------------------------------------------------------
    ' main-Line processing
    '-------------------------------------------------------------------------------
    Sub Main(Client, GWEvent)
    
      dim oFolder
      dim iSyntax
      dim iFolderPath
    
      set oFolder = GroupWise.Account.RootFolder.Folders.ItemByName(FOLDER_NAME_QUERY)
    
      ' Get the folder path
      call GetFolderPath(oFolder, iFolderPath)
    
      ' Remove the last '' delimiter from the path
      iFolderPath = RemoveTrailingDelimiter(iFolderPath)
    
      if iFolderPath = "" then
        exit sub
      end if
    
      ' Select the 'Unopened Items' folder
      call GroupWise.FolderSelect(iFolderPath)
    
      ' Change the folder settings
      iSyntax = "DisplaySettingsSetEx(""" & iFolderPath & """;""" & SETTINGS_NAME & """)"
    
      if GroupWise.ThrowToken(iSyntax, "") then
        msgbox("Display settings updated.")
      end if
    
      set oFolder = nothing
    
    End Sub
    
    function GetFolderPath(aFolder, aPath)
    
      dim iFolder
    
      if aFolder is nothing then
        exit function
      end if
    
      aPath = aFolder.name & "" & aPath
      if aFolder.ObjType <> fgwRoot then
        set iFolder = aFolder.ParentFolder
        call GetFolderPath(iFolder, aPath)
        set iFolder = nothing
      end if
    
    end function
    
    function RemoveTrailingDelimiter(aPath)
    
      aPath = trim(replace(aPath, "\", ""))
    
      dim iChar
    
      iChar = right(aPath, 1)
      if iChar = "" then
        aPath = mid(aPath, 1, len(aPath) -1)
      end if
    
      RemoveTrailingDelimiter = aPath
    
    end function

    I hope this helps.

    Advansys Support