/ Forums / Advansys Formativ / Creating Solutions with Formativ / Create Folder and Copy Current Item / Reply To: Create Folder and Copy Current Item

#6633
Support 1a
Participant

    Yes, you can certainly do this kind of thing with Formativ. Here’s some sample code to help get you started:

    dim iMsg 
    dim iFolder
      
    '-------------------------------------------------------------------------------
    ' Main-Line processing
    '-------------------------------------------------------------------------------
    Sub Main(Client, GWEvent)
       
      on error resume next
      Set iMsg = Client.ClientState.CommandMessage
      
      if not isobject(iMsg) then
        call msgbox("Please select a message to proceed.", vbInformation, "Message Management")
        exit sub    
      end if
      
      ' Create the destination folder
      CreateFolder()
      
      ' Move the message from the current folder into the destination folder's messages collection
      call Client.ClientState.SelectedFolder.messages.move(iMsg.MessageID, iFolder.Messages)
      
      set iMsg = nothing
      set iFolder = nothing
        
    End Sub
     
     
     
    
    '-------------------------------------------------------------------------------
    ' Create the folder if not exists
    '-------------------------------------------------------------------------------
    sub CreateFolder()
       
      dim iRootFolders
     
      groupwise.account.refresh  
      set iRootFolders = groupwise.account.RootFolder.folders
      
      on error resume next
      set iFolder = iRootFolders.ItemByName("People")
          
      if iFolder is nothing then
        set iFolder = iRootFolders.add("People")
      end if
                   
      set iRootFolders = nothing  
      
    end sub
    

    I hope this helps.

    Advansys Support