我的计算机上安装的是 Office 2013 32 位。我开发了一个 Intranet,但在我客户的服务器和 Windows session 上:它是 Office 2016 32 位... 在我的 vs2017 上,我安装了 block 包 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 感谢您的帮助
更新 在我的项目的属性上,我激活了“任何 CPU”选项
最佳答案
最后... 一个 friend 说我,我的方法只有在服务器上打开 session 才可以。 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()
希望对您有所帮助
关于vb.net - 如何用vs2017打开Outlook 2016,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48683301/