簡體   English   中英

如何使用vs2017打開Outlook 2016

[英]How to open Outlook 2016 with vs2017

我在我的電腦Office 2013 32bits上。 我開發了一個Intranet,但在我的客戶的服務器和Windows會話上:它是一個Office 2016 32位...在我的vs2017上,我使用nugget包安裝了microsoft.office.interop 15.0.4797.1003但它適用於Office 2013.我創建了一個郵件

dim outl as new outlook.application
dim Mai las outl.mailitem=outl.createItem(Micrososft.office.Interop.outlook.olitemtype.olmailItem)
Mail.To=...
...
Mail.attachment.add(MyFile)
Mail.display()

我嘗試將我的代碼放在客戶服務器上,並且像我一樣... 80070005訪問被拒絕...我找不到如何打開Outlook 2016感謝您的幫助

UPDATE在我的項目的屬性上,我激活了“任何CPU”選項

最后......朋友說我,我的方法只有在我打開服務器上的會話時才可以。 outlook.display在服務器上運行而不在其他計算機上的客戶端上運行。 然后我改變主意並構建一個emml文件,存儲並用ashx文件推送

 For Each _file As String In IO.Directory.GetFiles(IO.Path.GetDirectoryName(Path), "*.eml")
                        IO.File.Delete(_file)
                    Next

                    Dim MailMdp As New Net.Mail.MailMessage
                    MailMdp.Subject = Vers.Devi.Libelle
                    MailMdp.From = New Net.Mail.MailAddress(ConnectedUser.Mail)

                        MailMdp.To.Add(AnAdress)

                    MailMdp.Body = "Bonjour,"
                    Dim att As New Net.Mail.Attachment(Path)
                    MailMdp.Attachments.Add(att)
                    MailMdp.IsBodyHtml = True

                    Dim Client As Net.Mail.SmtpClient = New Net.Mail.SmtpClient()
                    Client.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.SpecifiedPickupDirectory
                    Client.PickupDirectoryLocation = IO.Path.GetDirectoryName(Path)
                    Client.Send(MailMdp)

                    Dim MonEml = IO.Directory.GetFiles(IO.Path.GetDirectoryName(Path), "*.eml", IO.SearchOption.TopDirectoryOnly).First

                    Dim fso As New System.IO.FileInfo(MonEml)
                    Dim NomFichier As String = fso.Name
                    context.Response.Clear()
                    context.Response.ClearContent()
                    context.Response.ClearHeaders()
                    context.Response.ContentType = "message/rfc822"
                    context.Response.AppendHeader("Content-Disposition", "attachment; filename=" & NomFichier)
                    context.Response.TransmitFile(MonEml)
                    context.Response.End()

我希望這可以有所幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM