Support 1

    Thank you for your question. Below is a code sample to creates a search results folder that I think matches your requirement.

    Const FOLDER_NAME_QUERY = "Unopened Items"
    Sub Main(Client, GWEvent)
      dim oQuery
      dim oFolder
      call GroupWise.Account.Refresh
      On Error Resume Next
      set oFolder = GroupWise.Account.RootFolder.Folders.ItemByName(FOLDER_NAME_QUERY)
      ' Exit, if the folder is exists
      if IsObject(oFolder) Then
        MsgBox ("The folder '" & FOLDER_NAME_QUERY & "' already exists in your Cabinet. " &_
        "If required, you can rename the existing search folder and run this applet again.")
        exit sub
      end if
      ' Creates a new Query object
      set oQuery = GroupWise.Account.CreateQuery
      ' Set up a Filter expression.
      oQuery.Expression = "(MAIL) AND (NOT OPENED) AND (BOX_TYPE = INCOMING)"
      call oQuery.Locations.Add(GroupWise.Account.Mailbox)
      ' Run the query whenever the folder is selected.
      oQuery.StartOnOpen = true
      call oQuery.CreateFolder(FOLDER_NAME_QUERY, GroupWise.Account.RootFolder)
      call GroupWise.Account.Refresh
      call MsgBox ("The folder '" & FOLDER_NAME_QUERY & "' was created under the root folder.")
      set oQuery = Nothing
      set oFolder = Nothing
    End Sub

    I hope this helps.

    Advansys Support