vb.net json序列化outlook mailitem userproperties返回部分空白

时间:2017-02-22 01:57:01

标签: json vb.net outlook

我正在尝试stringify序列化Outlook MailItem UserProperties(IEnumerable),但仍然像这样继续获取空白值:

[{},{},... {}]

MailItem是一个自定义表单!。

{}的数量对UserPropeties有很大帮助!

以下是代码和示例输出:

Imports System.Web.Script.Serialization

Private Sub ExractProperties(oMailItem As Outlook.MailItem)
    Dim jsonSer As New JavaScriptSerializer
    Dim i As Integer
    Dim sName As String
    Dim sValue As String

    For i = 1 To oMailItem.UserProperties.Count
        Try
            sName = oMailItem.UserProperties.Item(i).Name
        Catch ex As Exception
            sName = ""
        End Try

        Try
            sValue = oMailItem.UserProperties.Item(i).Value.ToString()
        Catch ex As Exception
            sValue = ""
        End Try

        TextBoxProgress.Text = TextBoxProgress.Text & sName & ":" & sValue & vbCrLf
    Next

    TextBoxProgress.Text = TextBoxProgress.Text & jsonSer.Serialize(oMailItem.UserProperties) & vbCrLf
End Sub

样本输出(浓缩)

1-RequestersName:sample name
1-RequestersOffice:sample office
1-RequestersOther:
1-RequestersPhone:12341234
1-RequestersRank:sample rank
1-ServiceRequested:
2-ServiceRequested:sample service
.
.
.
Approver:Sample Approver
ApproverPhone:12341234
ApproverUnit:Sample Unit
From:somebody
LastAction:Read
Sent:31/12/1999 6:25:13 PM
Subject:Sample Subject
To:Receiver

[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]

0 个答案:

没有答案