/ Forums / Advansys Formativ / Creating Solutions with Formativ / Accessing the currently selected attachment / Reply To: Accessing the currently selected attachment

#8224
Support 3
Participant

Message view must be open to get the current selected attachment index. Please see the Novell Token API documentation for more information:
http://developer.novell.com/documentation/gwtoken/index.html?gwtokens/data/hj8ej8g5.html

Following information copied from the Novell Token API documentation:

quote:


ItemAttachmentGetCurrentIndex()

Returns the current attachment index. The item view must be open with the attachment selected.
Token ID

AFTKN_ITEM_ATTACHMENT_CURRENT or 758

Syntax

WORD ItemAttachmentGetCurrentIndex()

Return Values

WORD. Current attachment index (zero-based).


If you have the message view opened then you can use following code to get current attachment index and save the attachment.

  
  messageID = groupwise.ItemMessageIDFromView
  attachmentIndex = groupwise.ItemAttachmentGetCurrentIndex

  fileName = groupwise.ItemAttachmentGetDisplayName(messageID, attachmentIndex)

  call groupwise.ItemAttachmentSaveAs(messageID, attachmentIndex, "c:temp" + fileName)

FYI, to make easier for the developer, Formativ wrap most of the GroupWise Tokens. For example:
GroupWise.ItemAttachmentGetCurrentIndex()

Formativ also provide option to call directly the token using the ThrowToken() method:
msgbox groupwise.throwtoken(“ItemAttachmentGetCurrentIndex()”, iRetunVal)

See the Formativ Language Guide for more information.

Regards,

Advansys Support