从Outlook获取唯一ID电子邮件

时间:2020-07-07 14:36:35

标签: c# email outlook

我将其留给您,因为我无法在Internet上找到解决方案。 我解释说我正在使用一个库(EaGetMail),该库允许我管理电子邮件,但是现在我不得不更改该库,因此我选择了Outlook库。

但是,我不可能重现旧库中的结果。

使用EagetMail,我可以检索以数字格式类型接收的电子邮件的唯一标识符,例如:123 并且每次我收到新电子邮件时,其标识符都比先前收到的电子邮件大(例如:131)。 但是Outlook库的问题在于,唯一标识符是数字和字符的混合体,这对我的算法是有问题的。如何以与EaGetMail库(C#)相同的方式检索唯一标识符?

提前谢谢;)

1 个答案:

答案 0 :(得分:0)

Outlook使用Sub test() Dim cellValue As Range, vDB As Variant Dim i As Long, r As Long Dim deviceName r = ActiveSheet.UsedRange.Rows.Count 'Set r to suit your situation. 'Row and rows are similar to reserved words in visual basic, so we don't recommend them. For i = 2 To r 'Because range is an object, you must use the set statement. Set cellValue = ActiveSheet.Range("B" & CStr(i) & ":" & "G" & CStr(i)) 'same code above Set cellValue = ActiveSheet.Range("B" & i & ":" & "G" & i) '<~~ When it is made by connecting letters and numbers, it becomes a letter. Set cellValue = ActiveSheet.Range("B" & i, "G" & i) '<~~ The first part of the comma is the first cell in the region, and the last part is the last cell in the region. Set cellValue = ActiveSheet.Range("B" & i).Resize(1, 6) '<~~ 1 is rows.count, 6 is columns.count ; Change the size of the range to the size of the resize statement. 'If the set statement is not used, it is an array of variants. vDB = ActiveSheet.Range("B" & i & ":" & "G" & i) 'vDB is 2D array deviceName = cellValue.Cells(1) 'same above code deviceName = cellValue.Range("a1") deviceName = cellValue(1) deviceName = cellValue.Cells(1).Offset(0, 0) 'If you use arrays, vDB deviceName = vDB(i, 1) Next i End Sub 字符串来唯一标识项目。但是,如果您需要一个数字,每次接收新项目时该数字都会增加,则可以添加用户属性,请参见UserProperties.Add,以获取更多信息。

EntryID