[英]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.