输入问题?

JavaK JavaK 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Sub SendNotesMail(Subject As String, Attachment, Recipient As String, BodyText As String, SaveIt)
'Set up the objects required for Automation into lotus notes
Dim Maildb 'The mail database
Dim UserName 'The current users notes name
Dim MailDbName 'THe current users notes mail database name
Dim MailDoc 'The mail document itself
Dim AttachME 'The attachment richtextfile object
Dim Session 'The notes session
Dim EmbedObj 'The embedded object (Attachment)

'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string

UserName = Session.UserName
MailDbName = Left(UserName, 1) & Right(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", MailDbName)
'Set Maildb = Session.GETDATABASE("", "mail.box")

If Maildb.ISOPEN = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If

'Set up the new mail document
Set MailDoc = Maildb.createdocument
MailDoc.form = "Memo"
MailDoc.sendto = Recipient
MailDoc.Subject = Subject
MailDoc.Body = BodyText
MailDoc.SAVEMESSAGEONSEND = SaveIt

'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
'MailDoc.CREATERICHTEXTITEM ("Attachment")
End If

'Send the document
MailDoc.Send 0, Recipient

'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub

Sub main()
Call SendNotesMail("this is a test subject", "C:\test.jpg", "test user2", "My Message", True)
End Sub

关于这段代码,我将CreateObject 改为先引用Object (Lotus Domino Object-domobj.tlb) 然后用,Dim Session As New Domino.NotesSession
(程序出错)就有一些方法用不了,请问是什么原因,还有别一个Object (Lotus Notes Automation Class-Notes32.tlb)这个和前一个的方法都很多相同,有什么区别?
我在网上也找了一些资料都没有说有过我现在的这种情况。还有一点我怎么样可以不需要安装Lotus Domino我想把NotesSession (发邮件功能)
这个Class独立打包出来供C#调用,网上哪里是否有下载。我以前也没有接触过 Lotus Domino 请高手帮忙啊!给100分.
...全文

相关推荐

评论 12
收藏 已收藏
分享
返回顶部
JavaK
C# 111,129 成员 642,540 内容