#6696
Support 1a
Participant

    As will most access to the GroupWise message store, you need to use the GroupWise Object API, which is exposed in Formativ via the GroupWise.Account object.

    To save a DMS document to disk, you need to locate the appropriate DocumentReference object, access it’s Document property, then locate the appropriate DocumentVersion you wish to save. You then check out the document to phsically save it to disk, then check it back in again. (If you don’t check it back in the document will be unavailable to other users).

    Here is some sample code that shows how this can be done given a DocumentReference object:

      private function GetDocument(aMsg)
        
        GetDocument = ""
        
        if aMsg is nothing then
          exit function
        end if
      
        on error resume next
        
        ' Exit, if the document is checked out.
        if aMsg.Document.CurrentVersion.CheckedOut then
          exit function
        end if
        
        ' Exit, if the document is inuse by another application.
        if aMsg.Document.CurrentVersion.InUse then
          exit function
        end if  
        
        dim iDocPath
        dim iDocumentName
        
        
        iDocumentName = replace(trim(aMsg.subject), ".", "")
        if iDocumentName = "" then
          iDocumentName = "Document"
        else
          iDocumentName = GetLegalFileName(iDocumentName)
        end if
        
        iDocumentName = iDocumentName & "." & replace(aMsg.Document.CurrentVersion.OriginalFileType, ".", "")
        
        iDocPath = iWorkFolderName & iDocumentName
        
        aMsg.Document.CurrentVersion.CheckOut(iDocPath)
        call aMsg.Document.CurrentVersion.CheckIn(iDocPath, 0)
        
        GetDocument = iDocPath
          
      end function

    Advansys Support