• Creator
    Topic
  • #3938
    Anonymous

      I am exporting documents from GW to files and want to preserve the folder structure from GW in the file structure.

      I try:

      MyOneDocVersion = MyOneDoc.CurrentVersion
      MyOneDocVersion.CopyOut(FN)

      This does export the file fine, but how can I find the GW-folder of the document?

      I tried also running through the GW Folder Structure and getting the message with the MessageID using ItemSaveMessage.
      How would I get to the actual document when having the MessageID of a message?

      Your help is appreciated!
      Beat

    • Author
      Replies
    • #6661
      Support 1a
      Participant

        You would need to obtain the document reference enclosing folder object, read its name property, then recurse up through the enclosing folder properties until you get to the top of the account. Using this technique you could build a string representing the full folder structure to the document, i.e.

        “UserNameDocumentsProject X”

        Here’s some code you can use to access the enclosing folder of the selected message:

        dim oMsg
          
          Set oMsg = Client.ClientState.CommandMessage
          
          ' Refresh the folders collection 
          groupwise.account.refresh
            
          ' The folder this item is contained in.
          if (oMsg.EnclosingFolders.count > 0) then
            msgbox oMsg.EnclosingFolders.item(1).name
          end if
          
          set oMsg = nothing 
        
        

        To obtain the physical document via the message ID, I suspect you would need to use GroupWise.Account.GetMessage(MessageID) to obtain an instance of the document reference object, then save the current version out as you are currently doing.

        I hope this helps.

        Advansys Support

        #6658
        Anonymous

          Many Thanks, Dave,

          You say, that with GroupWise.Account.GetMessage(MessageID) I get an instance of the document reference object.
          However, there is an Error executing this code on the sond line:
          Set oDoc = GroupWise.Account.GetMessage(MyMsg.MessageID)
          MyDocNumber = oDoc.DocumentNumber

          I assume GroupWise.Account.GetMessage(MyMsg.MessageID) gets a reference to an instance of the message object.

          How can I get a reference to the document?

          regards
          Beat

          #6657
          Support 1a
          Participant

            Remember there is a different between a document reference object (which GetMessage() is going to return) and a document object.

            Once you have an instance of your document reference object, you need to access it’s document property in order to work with the physical document.

            Here’s some psuedo code:

            set oDocRef = GroupWise.Account.GetMessage("abcdefg")
            MsgBox oDocRef.Document.DocumentNumber

            In your example code it appears you already have the Document Reference object (MyMsg.MessageID), so there’s no need to call GetMessage – it’s going to return the object you already have. All you need to do is reference the Document Reference’s .Document property.

            I hope this helps.

            Advansys Support

            #6659
            Anonymous

              Many Thanks! You helped me a lot!

              It works now.

              The missing element was the .Document Attribute on the Message Object.

              MyDoc = oMsg.Document

              In the Novell GroupWise Object API documentation, the object Message does not have a Document property. Is there another Documentation describing this (and many other useful) features?

              best regards
              Beat

              #6660
              Support 1a
              Participant

                The object you are working with in this case is actually a ‘Document Reference’ object, which is derived from the ‘Message’ object type. Look up DocumentReference in the Object API documentation. You notice it says at the top of the page it is a subtype of Message.

                I hope this helps.

                Advansys Support

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