我在我的电脑办公室,2013年32位。我开发了一个Intranet,但是在我的客户的服务器和windows会话上:它是一个Office 2016 32位.在我的vs2017上,我安装了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的访问被拒绝.我找不到打开2016年展望的方法谢谢你的帮助
更新我的项目属性的,我有“任意CPU”选项激活
发布于 2018-03-09 20:38:13
终于..。一位朋友说,只有当我在服务器上打开会话时,我的方法才能正常。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()我希望这能帮上忙
https://stackoverflow.com/questions/48683301
复制相似问题