Visual studio 2010 将数据从Outlook获取到数据库

Visual studio 2010 将数据从Outlook获取到数据库,visual-studio-2010,outlook,Visual Studio 2010,Outlook,我的项目是将Visual Studio之前的字段发送到Outlook正文中,在接收到消息后正文中输入的字段中用户可以修改Outlook文本字段中发送的数据并发送更新数据它将保存在数据库中,这样就可以将数据从Outlook更新到数据库了?我已经构建了这样的解决方案,我每天使用它阅读和归档邮件,这是我日常工作流程的一部分。但正如其他人暗示的那样,你需要具体说明你需要什么帮助 If (TypeOf olItem Is Outlook.MailItem) Then

我的项目是将Visual Studio之前的字段发送到Outlook正文中,在接收到消息后正文中输入的字段中用户可以修改Outlook文本字段中发送的数据并发送更新数据它将保存在数据库中,这样就可以将数据从Outlook更新到数据库了?

我已经构建了这样的解决方案,我每天使用它阅读和归档邮件,这是我日常工作流程的一部分。但正如其他人暗示的那样,你需要具体说明你需要什么帮助

        If (TypeOf olItem Is Outlook.MailItem) Then
            Dim olMailItem As Outlook.MailItem = TryCast(olItem, Outlook.MailItem)

            If olMailItem.Permission = Outlook.OlPermission.olUnrestricted Then
                strBody = olMailItem.HTMLBody                   'file:///C:/AttSave/header.png
            Else
                strBody = "Rights Protected fix if I'm not in debugger"
            End If

            For Each olAttach In olMailItem.Attachments
                If olAttach.Type <> Outlook.OlAttachmentType.olOLE Then
                    olAttach.SaveAsFile("c:\AttSave\" & olAttach.FileName)
                    'strBody = strBody.Replace("cid:header", "file:///C:/AttSave/header.png")
                    strCID = olAttach.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E")
                    If strCID <> "" Then
                        strBody = strBody.Replace("cid:" & strCID, "file:///C:/AttSave/" & System.Web.HttpUtility.UrlEncode(olAttach.FileName))
                    End If
                    lst_Attach.Items.Add(olAttach.FileName)
                Else
                    MsgBox("open this one via outlook")
                End If

            Next
            Me.webBody.DocumentText = strBody
            Me.txtSubject.Text = olMailItem.Subject
            If olMailItem.Importance = Outlook.OlImportance.olImportanceHigh Then
                Me.txtSubject.ForeColor = Color.Red
            Else
                Me.txtSubject.ForeColor = Color.White
            End If

            'Dim palSender As Microsoft.Office.Interop.Outlook.AddressEntry
            'palSender = mailItem.Sender
            Me.txtSentDate.Text = olMailItem.SentOn
            'Me.txtTo.Text = olMailItem.To
            olSenderA = olMailItem.Sender
            If IsNothing(olSenderA) = False Then

                'Dim olConItem As Outlook.ContactItem

                'olConItem = olSenderA.GetContact()
                'If Not IsNothing(olConItem) Then
                '    If olConItem.HasPicture = True Then
                '        Stop
                '    End If
                'End If


                Pa = olSenderA.PropertyAccessor
                'Debug.Print(olRe.Name & "stp= " & Pa.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x39FE001E"))
                Try
                    Me.txtFrom.Text = Me.txtFrom.Text & olSenderA.Name & " (" & Pa.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x39FE001E") & ")"
                Catch ex As System.Runtime.InteropServices.COMException
                    'Stop
                    Me.txtFrom.Text = olMailItem.SenderName & " (" & olMailItem.SenderEmailAddress & ")"
                Catch ex As Exception
                    Stop
                End Try
如果(olItem的类型为Outlook.MailItem),则
Dim olMailItem作为Outlook.MailItem=TryCast(olItem,Outlook.MailItem)
如果olMailItem.Permission=Outlook.OlPermission.olUnrestricted,则
strBody=olMailItem.HTMLBody'file:///C:/AttSave/header.png
其他的
strBody=“如果我不在调试器中,则修复受权限保护的问题”
如果结束
对于olMailItem.Attachments中的每个olAttach
如果是olAttach.Type Outlook.OlAttachmentType.olOLE,则
SaveAsFile(“c:\AttSave\”&olAttach.FileName)
'strBody=strBody.Replace(“cid:header”file:///C:/AttSave/header.png")
strCID=olAttach.PropertyAccessor.GetProperty(“http://schemas.microsoft.com/mapi/proptag/0x3712001E")
如果strCID为“”,则
strBody=strBody.Replace(“cid:&strCID,”file:///C:/AttSave/“&System.Web.HttpUtility.UrlEncode(olAttach.FileName))
如果结束
lst_Attach.Items.Add(olAttach.FileName)
其他的
MsgBox(“通过outlook打开此文件”)
如果结束
下一个
Me.webBody.DocumentText=strBody
Me.txtSubject.Text=olMailItem.Subject
如果olMailItem.Importance=Outlook.OlImportance.olImportanceHigh,则
Me.txtSubject.ForeColor=颜色.红色
其他的
Me.txtSubject.ForeColor=颜色.白色
如果结束
'Dim palSender作为Microsoft.Office.Interop.Outlook.AddressEntry
'palSender=mailItem.Sender
Me.txtSentDate.Text=olMailItem.SentOn
'Me.txtTo.Text=olMailItem.To'
olSenderA=olMailItem.Sender
如果IsNothing(olSenderA)=False,则
'将olConItem设置为Outlook.ContactItem
'olConItem=olSenderA.GetContact()
“如果不是什么(olConItem),那么
'如果olConItem.HasPicture=True,则
“停
"完"
"完"
Pa=olSenderA.PropertyAccessor
'Debug.Print(olRe.Name&'stp=“&Pa.GetProperty('http://schemas.microsoft.com/mapi/proptag/0x39FE001E"))
尝试
Me.txtFrom.Text=Me.txtFrom.Text&olSenderA.Name&(“&Pa.GetProperty(”http://schemas.microsoft.com/mapi/proptag/0x39FE001E") & ")"
捕获例如System.Runtime.InteropServices.COMException
“停
Me.txtFrom.Text=olMailItem.SenderName&“(&olMailItem.SenderEmailAddress&”)
特例
停止
结束尝试

可以从outlook读取数据,但您的问题不够清楚,outlook正文是什么?!你是说邮件正文还是什么?你当然可以,但你能展示你迄今为止所做的尝试吗,还有什么不起作用?Vahind是的,我是说电子邮件正文我问outlook和Visual studio之间是否有一些相似之处,因为我尝试在VBA上用outlook编程,但它不起作用,我不容易谢谢你,谢谢你,但我需要读正文项而不是文件项,对于每个文本框,我都将其保存在表中的数据库中(姓名、即兴表演、挑战、日期挑战、评论)