Notes.NotesSession与Domino.NotesSession密码提示 [英] Notes.NotesSession vs Domino.NotesSession Password Prompt

查看:116
本文介绍了Notes.NotesSession与Domino.NotesSession密码提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,我对参考文件/COM/dll的理解不足.

Apologies for my poor understanding of references/COM/dlls.

我有一个没有 Option Strict 的VB.Net应用程序.它使用下面的代码发送Lotus电子邮件.

I have a VB.Net application without Option Strict. It uses the code below to send lotus emails.

Dim s As Object = CreateObject("Notes.Notessession")
Dim db As Object = s.GetDatabase("", "")
Call db.openmail()
doc = db.CreateDocument
doc.ReplaceItemValue("SendTo", "someEmail@someEmailSpot.com")
doc.ReplaceItemValue("Subject", "Some subject text")
doc.ReplaceItemValue("Body", "Some body text")
Call doc.Send(False)

当我使用 Option Strict 重新创建代码时,

When I recreate the code with Option Strict the

Dim db As Object = s.GetDataBase("", "")

line 在 s.GetDataBase 下有一个延迟绑定错误,我不知道如何解决.我找不到要添加到项目中的引用,因此无法将其转换为Notes.Notessession.

line has a late binding error, under s.GetDataBase, which I don't know how to resolve. I can't find a reference to add to my project so that I can cast it to a Notes.Notessession.

相反,我可以使用以下引用-"莲花Domino对象" Interop.Domino.dll -编写以下代码.

I was instead able to use the following reference -- "Lotus Domino Objects" Interop.Domino.dll -- to write the code below.

Dim session As New Domino.NotesSession
session.Initialize()
Dim dir As Domino.NotesDbDirectory = session.GetDbDirectory("")
dir.OpenMailDatabase()
Dim db As Domino.NotesDatabase = dir.OpenMailDatabase
Dim doc As Domino.NotesDocument = db.CreateDocument
doc.ReplaceItemValue("SendTo", "someEmail@someEmailSpot.com")
doc.ReplaceItemValue("Subject", "Some subject text")
doc.ReplaceItemValue("Body", "Some body text")
doc.Send(False)

问题似乎是Domino.NotesSession要求我提供一个密码,而Notes.NotesSession却没有提供密码,无论是作为初始化中的参数还是在没有密码的情况下创建的提示中,就像上面的代码一样.

The problem is it seems Domino.NotesSession requires me to provide a password where Notes.NotesSession did not, either as a parameter in initialize or in a prompt that is created if no password is passed, like the code above.

我的问题是:

  1. Domino.NotesSession对象是否可以像Notes.NotesSession对象一样无需密码来初始化?

  1. Is there a way for the Domino.NotesSession object to initialize without needing a password, like the Notes.NotesSession object does?

在运行时创建Notes.NotesSession对象时引用了什么,以及如何在设计时添加此引用?

What is being referenced at runtime to create the Notes.NotesSession object, and how can I add this reference at design time?

是否可以查看某个对象在运行时绑定到什么类型的对象?大概在第一个代码块中, s 被绑定到Notes.Notessession,但是在监视中或使用TypeOf查看它只是返回一个通用的"_ComObject".

Is there a view to view what type of object something has late bound to at runtime? Presumably in the first code block, s is being binded to a Notes.Notessession, but viewing it in watch or using TypeOf just return a generic "_ComObject".

推荐答案

Notes.NotesSession是Notes客户端OLE对象的根.Domino.NotesSession是Notes/Domino数据的COM对象的根.

Notes.NotesSession is the root of the OLE objects for the Notes client. Domino.NotesSession is the root of the COM objects for Notes/Domino data.

仅在Notes客户端已在运行的情况下,OLE对象才可以避免出现密码提示.如果未运行,则调用OLE对象将启动客户端并提示输入密码.大多数人避免使用 OLE 对象,除非他们真的要使用它们来驱动 Notes UI,这是通过 Notes.NotesUIWorkspace 和各种其他 NotesUI 类完成的.

The OLE objects can avoid a password prompt only if the Notes client is already running. If it's not running, invoking the OLE object starts the client and prompts for a password. Most people avoid using the OLE objects unless they are actually going to use them to drive the Notes UI, which is done with the Notes.NotesUIWorkspace and various other NotesUI classes.

由于Domino.NotesSession是COM,因此它独立于客户端运行,但仍使用与客户端一起安装的Notes API.Notes的安全设置(文件-安全-用户安全-安全基础)中有一个复选框,标记为不提示其他基于Notes的程序输入密码".如果选中该框,那么如果Notes客户端已经在运行,则在调用COM类时不会出现密码提示.本质上,这使您可以平等地使用OLE类.但是请注意:在该复选框的说明旁边,在括号中显示为( reduce security )".许多人确实选择启用此设置,但是您需要意识到它确实可能会打开一个漏洞,不可靠的代码可能会使用用户的凭据来访问Notes数据库信息.

Since Domino.NotesSession is COM, it runs independently of the client, but it still uses the Notes APIs that were installed with the client. There is a checkbox in Notes' security settings (File - Security - User Security - Security Basics) labeled "Don't prompt for a password from other Notes-based programs". If you check that box, then you won't get a password prompt when you invoke the COM classes if the Notes client is already running. Essentially that puts you on equal footing with using the OLE classes. But note: Right next to that check box item's description, in parenthesis, it says "(reduces security)". A lot of people do choose to enable this setting, but you do need to be aware that it does potentially open a hole through which untrustworthy code might be able to access Notes database information using a the user's credentials.

关于为什么在IDE中看不到引用的原因,我们只能说它一直是不一致的,然后保留它.我不能给你任何押韵或理由.就是说,最好不要看到Notes.NotesSession引用,因为如果人们看到两者,那只会使人们感到困惑.大多数人应该使用COM类.

Regarding why you do/don't see the references in the IDE, let's just say that it's always been inconsistent and leave it at that. I can't give you any rhyme or reason. That said, it's probably better not to see the Notes.NotesSession reference because it just confuses people if they see both. Most people should be using the COM classes.

这篇关于Notes.NotesSession与Domino.NotesSession密码提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆