Skip to main content

Get-Mail-List

Command Description

Get the message list in a specified mailbox, and return as an array

Command Prototype

arrayRet = Outlook.GetMailMessages(account,folder,sfilter,unread,markasread,count)

Parameter Description

ParameterRequiredTypeDefaultDescription
accountTruestring""Specify the email address to get the mailing list from. It must be the same as the email address bound to Outlook
folderTruestring""Mailbox folders to get, such as "Inbox", "Draft", "Sent Mails", etc
sfilterTruestring""The filter criteria (case sensitive) used to filter eligible emails by title, content, sender, recipient, CC, and bcc
unreadTruebooleanTrueWhether to get unread messages only
markasreadTruebooleanTrueWhether to mark the obtained unread messages as read
countTruenumber0Specify the number of emails to obtain, 0 means to obtain all

return

arrayRet,The variable used to save the output of the command.

Demo

/************************************Get mailing list************ ******************************** 
**Entry 1
** account--sender's email address, which must be the same as the email address bound to Outlook.
**Entry 2
** folder--The mailbox folder that needs to be obtained, such as "Inbox", "Drafts", "Sent Items" and other folders.
**Entry 3
** sfilter--filter conditions (case sensitive), filter eligible emails from the subject, content, sender, recipient, cc, bcc of the email
**Entry 4
** unread--Whether to get only unread emails.
**Entry 5
** markasread--whether to mark the fetched unread emails as read.
**Entry 6
** count--Specify the number of emails to get, 0 means get all.
**Exit
** arrayRet--The variable to which the output of the function call is saved.
*****************************************************************************************/
TracePrint "--------------------------------------------Get mailing list- ---------------------------------------------"
arrayRet = Outlook.GetMailMessages("lzz1712@outlook.com","Inbox","Test",False,True,0)
TracePrint "Get mail titled sysadmin in inbox:"&CStr(arrayRet)
TracePrint "----------------------------------------------------------------------------------------------------"