Solved

Retrieve signature in Lotus Notes 7

Posted on 2006-07-18
10
1,226 Views
Last Modified: 2010-05-18
Hi all,

The following snippet code works as expected in classic VB (using early binding with reference to Lotus Domino) in that it retrieve the signature in plain text:

stSignature = db.GetProfileDocument("CalendarProfile").GetFirstItem("Signature").Text

How should I do to retrieve the same information when using VB.NET?

TIA,
Dennis
0
Comment
Question by:XL-Dennis
  • 5
  • 3
10 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17140368
Did you add any references for Lotus Notes to your project?

Bob
0
 
LVL 10

Author Comment

by:XL-Dennis
ID: 17140822
Why would I need to add a reference to Lotus Notes Automation Class when it already exist a reference to the Domino Object class?

As I mentioned in my first post the only issue I got is to retrieve the signature (which is plain text and not in HTML). Other then that it works without any issues in VB.NET :-)

BTW, would it be better if I asked about it in the Lotus Notes/Domino forum?

Kind regards,
Dennis



0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17141343
I was trying to figure out from your vague description what where you were having a problem.  You were talking about classic VB6, and so I wanted to make sure that you had all the references in VB.NET.

1) Are you getting exceptions when you try to accomplish the same thing with VB.NET?

2) What problems are having, if they aren't errors?

3) What .NET version are you using?  2002, 2003 or 2005?

Bob
0
 
LVL 10

Author Comment

by:XL-Dennis
ID: 17144950
Bob,

I'm not used to ask questions rather answer questions ;)

It turned out to be a casting issue which finally made it possible to solve the issue.

Platform: VB.NET 2005 with Option Strict On
Notes Client: 7.0.1
Domino Object class: 2.1 - Early binding

The following snippet code shows the solution:

'Instantiate the session.
Dim notSession As New Domino.NotesSessionClass
CType(notSession, Domino.NotesSession).Initialize("")
'Open the local mail database.
Dim notMailDb As Domino.NotesDatabase = CType(notSession, Domino.NotesSessionClass).GetDbDirectory("").OpenMailDatabase
'Grab the profile that holds the signature which will be added to the outgoing e-mail.
 Dim notProfile As Domino.NotesDocument = CType(notMailDb.GetProfileDocument("CalendarProfile"), Domino.NotesDocument)
'Grab the signature, which only can be done with signature in plain test.
Dim stSignature As String = CStr(notProfile.GetFirstItem("Signature").Text)
'Create the outgoing e-mail

I hope that the above can help other developers as well.

Kind regards,
Dennis

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 96

Expert Comment

by:Bob Learned
ID: 17151065
Thank you Dennis.  I have worked with Lotus, but not with .NET.  That information may prove to be helpful.

Asking questions is an artform that more people should embrace ;)

Bob
0
 
LVL 10

Author Comment

by:XL-Dennis
ID: 17152377
Bob,

I will keep this thread open as it may come new issues along the road before the solution is complete. After all, working with Lotus through COM is not an easy task.

Kind regards,
Dennis
0
 
LVL 10

Author Comment

by:XL-Dennis
ID: 17210691
To the TA administrator:

I wish to close this question and since I found out the solution myself I would suggest that the points are refunded.

Kind regards,
Dennis
0
 
LVL 10

Author Comment

by:XL-Dennis
ID: 17363311
Hi all,

Below is the function I finally created which is called from Excel:

'Function to create e-mail, add attachments and send.
    Function Create_Email_Notes(ByVal stPriority As String, _
                                ByVal stSubject As String, _
                                ByVal oSendTo As Object, _
                                ByVal oSendCopy As Object, _
                                ByVal stMessage As String, _
                                ByVal bFlag As Boolean, _
                                Optional ByVal stFile As String = "", _
                                Optional ByVal oFiles As Object = "") As Boolean
        'Create and instantiate the Lotus Notes session.
        Dim notSession As New Domino.NotesSessionClass
        CType(notSession, Domino.NotesSession).Initialize("")
        'Open the local mail database.
        Dim notMailDb As Domino.NotesDatabase = CType(notSession, Domino.NotesSessionClass).GetDbDirectory("").OpenMailDatabase
        'Grab the profile that holds the signature which will be added to the outgoing e-mail.
        Dim notProfile As Domino.NotesDocument = CType(notMailDb.GetProfileDocument("CalendarProfile"), Domino.NotesDocument)
        'Grab the signature, which only can be done with signatures in plain text.
        Dim stSignature As String = CStr(notProfile.GetFirstItem("Signature").Text)
        'Create the outgoing e-mail.
        Dim notDoc As Domino.NotesDocument = CType(notMailDb.CreateDocument, Domino.NotesDocument)
        'Create the body space in the outgoing e-mail.
        Dim notItem As Domino.NotesRichTextItem = CType(notDoc.CreateRichTextItem("Body"), Domino.NotesRichTextItem)
        'Create the attachment space in the outgoing e-mail.
        Dim notAttach As Domino.NotesRichTextItem = CType(notDoc.CreateRichTextItem("STFILE"), Domino.NotesRichTextItem)
        'Declare the variable for attached file(s).
        Dim notEmbedded As Domino.NotesEmbeddedObject

        If bFlag Then
            'Add the created file as attachment to the outgoing e-mail.
            notEmbedded = CType(notAttach.EmbedObject(EMBED_TYPE.EMBED_ATTACHMENT, "", stFile), Domino.NotesEmbeddedObject)
        Else
            'Add the files as attachments to the outgoing e-mail.
            Dim oItem As Object
            For Each oItem In CType(oFiles, Array)
                notEmbedded = CType(notAttach.EmbedObject(EMBED_TYPE.EMBED_ATTACHMENT, "", CStr(oItem)), Domino.NotesEmbeddedObject)
            Next
        End If
        Try
            'Populate the outgoing e-mail's main properties.
            With notDoc
                .AppendItemValue("Form", "Memo")
                .AppendItemValue("Subject", stSubject)
                .AppendItemValue("SendTo", oSendTo)
                .AppendItemValue("CopyTo", oSendCopy)
                .AppendItemValue("DeliveryPriority", stPriority)
                With notItem
                    .AppendText(stMessage & vbCrLf & vbCrLf)
                    .AppendText(stSignature & vbCrLf & vbCrLf)
                End With
                .SaveMessageOnSend = True
                .Send(True, "")
            End With
            'Set the status for the function to the calling sub.
            Create_Email_Notes = True
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
            'Set the status for the function to the calling sub.
            Create_Email_Notes = False
        Finally
            'Place variables to be handled by the Garbage Collector (GC).
            notEmbedded = Nothing
            notAttach = Nothing
            notItem = Nothing
            notProfile = Nothing
            notDoc = Nothing
            notMailDb = Nothing
            notSession = Nothing
        End Try
    End Function

Kind regards,
Dennis
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 17400109
PAQed with points refunded (500)

GhostMod
Community Support Moderator
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now