Skip to main content
Version: v6.5.0

Get email list

Command Description​

Retrieve Office365 Outlook emails and return them in array format

Command Prototype​

arrayRet = Office365.GetMail(o365Ctx ,strAccount , strFolderName , bUnreadOnly ,orderByDate ,strQuery ,bMarkRead ,strMailId ,iTop)

Command parameter​

parameterrequiredtypeDefault valuedescribe
o365CtxTrueexpressiono365CtxObjects returned by connecting to the Office365 server
strAccountTruestring""Account to be operated
strFolderNameTruestring""The email folder that needs to be obtained can be a path, such as "inbox/subdirectories"
bUnreadOnlyTruebooleanTrueDo you only retrieve unread emails
orderByDateTrueenum"NewestFirst"The rule of sorting by time
strQueryTruestring""Custom query statement, see for usagehttps://learn.microsoft.com/zh-cn/graph/filter-query-parameter?tabs=http
bMarkReadTruebooleanTrueMark as read email
strMailIdTruestring""Specify email ID, default empty
iTopTruenumber0Specify the number of messages to be obtained. 0 means All

Return result​

ArrayRet, Assign the result of running the command to this variable.

Run instance​

/*********************************获取邮件列表**************************************
命令原型:
arrayRet = Office365.GetMail(o365Ctx ,strAccount , strFolderName , bUnreadOnly ,orderByDate ,strQuery ,bMarkRead ,strMailId ,iTop)
入参:
o365Ctx--Office365对象.注:连接Office365服务器返回的对象
strAccount--帐户.注:待操作的帐户
strFolderName--邮箱文件夹.注:需要获取的邮箱文件夹,可以为路径,如"收件箱/子目录"
bUnreadOnly--未读邮件.注:是否只获取未读邮件
orderByDate--时间排序规则.注:按时间排序的规则
strQuery--查询语句.注:自定义查询语句,用法见 https://learn.microsoft.com/zh-cn/graph/filter-query-parameter?tabs=http
bMarkRead--标记已读.注:是否标记为已读邮件
strMailId--邮件Id.注:指定邮件Id,默认空
iTop--邮件数量.注:指定获取邮件的数量,0为全部获取
出参:
arrayRet--函数调用的输出保存到的变量.
注意事项:
无
********************************************************************************/
Dim arrayRet = ""
arrayRet = Office365.GetMail(o365Ctx ,"" , "" , True ,"NewestFirst" ,"" ,True ,"" ,0)
TracePrint(arrayRet)