MAPIQueryNoteText

Syntax

MAPIQueryNoteText(NoteText$, Size)

Remarks

Returns the text of the current inbound message. Of the current inbound message, MAPIQueryNoteText returns at most the number of characters specified in the Size argument. The function returns 1 if there is more text, or 0 (zero) if there is not.

Use successive calls to MAPIQueryNoteText to retrieve the text in usable chunks since the message text can be longer than 65,280 characters, the maximum length of a WordBasic string.

Argument

Explanation

NoteText$

A string containing text in the message

Size

The maximum number of characters to return


The following table lists the possible return values of the MAPIQueryNoteText function and their meanings.

Value

Meaning

1

The message contains additional text.

0

The message contains no additional text.


Example

The following example creates a new Word document, and copies to the document all the text of the first message in the Inbox. The text is copied in chunks of 1,024 characters.


Sub MAIN
FileNew
MAPI_LOGON_UI = 1
Session = MAPILogon(0, "", "", MAPI_LOGON_UI, 0)
Dim MessageID$, NoteText$
result = MAPIFindNext(Session, 0, "", "", 0, 0, MessageID$)
MAPI_SUPPRESS_ATTACH = 2048
MAPI_PEEK = 128
Flags = MAPI_SUPPRESS_ATTACH + MAPI_PEEK
result = MAPIReadMail(Session, 0, MessageID$, Flags, 0)
result = 1
While result = 1
    NoteText$ = String$(1024, 32)
    result = MAPIQueryNoteText(NoteText$, Len(NoteText$))
    Insert NoteText$
Wend
result = MAPILogoff(Session, 0, 0, 0)
End Sub