Thank you for your question above. A Document object (i.e. a document added to a library) and a document reference are two distinct objects. Given a document object, you need to create a document reference and associate with with the document object. Once you have created a document reference, you can attach it to a message as you would any other message object.
Assuming you add a document to a library and obtain a reference to the Document object like this:
set oDocument = iDocumentLibrary.Documents.Add(iAttachment, oDocumentType)
You then need to create a DocumentReference object in some folder and associate it with the document like this:
docref = GroupWise.Account.DocumentsFolder.Messages.Add("GW.MESSAGE.DOCUMENTREFERENCE", oDocument, fgwCurrent)
‘docref’ now refers to the DocumentReference object (in this case stored in the users Documents folder). You could then add this as an attachment to a message.
I hope this helps.