但是,在尝试创建Outlook实例时,UAC阻塞了此过程。我知道在windows 7上,UAC可以更改,但是windows 8不能完全删除。这就是为什么我需要这个进程的管理权限。
Try
' Get running outlook instance (if there is)
outlook = GetObject(Nothing, OUTLOOK_CLASS)
Catch ex As Exception
End Try
' No running instance? then create new instance of outlook
If IsNothing(outlook) = True Then
Try
outlook = CreateObject(OUTLOOK_CLASS)
Catch ex As Exception
End Try
End If
' Show error message if outlook is not installed
If IsNothing(outlook) = True Then
MsgBox(String.Format(My.Resources.ErrorEmailUnableToSend, vbCrLf, My.Settings.EmailNHD), MsgBoxStyle.Exclamation, My.Application.Info.Title)
Exit Try
End If
' Create the email message
email = outlook.CreateItem(mailItem)发布于 2015-10-13 16:14:50
COM系统将拒绝在不同的安全上下文中封送2个COM对象之间的调用。确保应用程序和Outlook都在相同的上下文中运行。
发布于 2015-10-13 14:53:04
您需要修改Manifest文件,以便应用程序在默认情况下以管理员模式启动
清单文件是VB项目中包含有关文件分发内容的信息的文件。它还允许应用程序声明它需要运行的特权级别,以及它是否需要提升。
Project > Add New ItemApplication Manifest File并单击Add。<requestedExecutionLevel level="asInvoker" uiAcces="false" />
asInvoker替换为requireAdministrator或highestAvailable<requestedExecutionLevel level="highestAvailable" uiAcces="false" />
这将使应用程序以最高可用权限运行。
https://stackoverflow.com/questions/33104027
复制相似问题