从结构中合并数组

问题描述 投票:0回答:1

我试图在outlook邮箱的所有子文件夹上运行DASL查询,然后在每个文件夹循环后将结果合并到主数组中。我已经尝试了下面的方法,但无法实现。任何指导或建议将是有帮助的

strFilter = "@SQL=" & "urn:schemas:httpmail:datereceived <> ''"
Dim eFolder as Outlook.Folder =  myNamespace.Folders("[email protected]").Folders("Inbox")

Dim oT As Outlook.Table = eFolder.GetTable(strFilter)
Dim RowCount As Integer = oT.GetRowCount

Dim VarArray As Array
VarArray = oT.GetArray(RowCount)

 'THIS DOES NOT WORK ----- VarArray=VarArray.Union(Ot.GetArray(RowCount))

我试过了

vb.net data-structures outlook-vba
1个回答
1
投票

你需要手动创建一个新的数组,从表中遍历数组中的所有条目。例如,你可以这样迭代所有项目。

'Get all items in Inbox that meet the filter 
 Set oTable = oFolder.GetTable(Filter) 

 On Error GoTo Err_Trap 
 varArray = oTable.GetArray(oTable.GetRowCount) 

   'Number of rows is the second dimension of the array 
   ubRows = UBound(varArray, 2) 
   'Number of columns is the first dimension of the array 
   ubCols = UBound(varArray) 

   'Array is zero-based 
   'Rows corrspond to items in the table, so for each item... 
   For j = 0 To ubRows 
     'Columns correspond to properties in the table, print the value of each property 
     For i = 0 To ubCols 
       Debug.Print varArray(i, j) 
     Next 
   Next 
 Exit Sub 

Err_Trap: 
 Debug.Print "Error#:" & Err.Number & " Desc: " & Err.Description 
 Resume Next 
© www.soinside.com 2019 - 2024. All rights reserved.