[C#] Lotus Notes DB openen

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

  • t-x-m
  • Registratie: November 2003
  • Laatst online: 24-08 11:21

t-x-m

.NET Nerd

Topicstarter
Achtergrondinfo
Eerst hadden we notes 6.5. Sinds een aantal weken maken we gebruik van Notes 8.5 (incl. domino server 8.5 en mailtemplates 8.5). Voor het maken van een mooie html signature had ik voorheen een programmaatje gemaakt welke een html bestandje -met signature- genereerde, omdat bij alle clients deze stond ingesteld op c:\lotus\notes\data\signature.html werd deze altijd netjes bijgewerkt na gebruik van het programmaatje. In notes 8.5 werkt dit anders en wordt de signature in de database opgeslagen. Nu ben ik daar mee aan de slag gegaan...

Probleem
Ik probeer met c# en een Notes COM object (C:\lotus\notes\domobj.tlb, v1.2) een database (mijn mailfile) te openen. Dit lijkt wel gelukt maar nu wil ik de huidige signature uitlezen (of beter nog, overschrijven).
Hiervoor heb ik de volgende code samengesteld:

C#:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class NotesSignature
{
    static void Main()
    {
        Domino.NotesSession session;
        Domino.NotesDatabase db;
        Domino.NotesDocument doc;

        try
        {
            session = new Domino.NotesSession();
            session.Initialize("mijnWachtwoord");

            db = session.GetDatabase("SERVER/DoMein", "mail\\mailfile.nsf", false);

            doc = db.GetProfileDocument("CalendarProfile", session.UserName);

            // Hier gaat het dus verkeerd:
            Console.WriteLine(doc.GetFirstItem("Signature_1").Text); // Notes 6.5 signature file location (?)
            Console.WriteLine(doc.GetFirstItem("Signature_Rich").Text); // Notes 8.5 html signature (?)
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
        finally
        {
            session = null;
        }
    }
}


Maar gezien het feit dat ik me hier meldt zal wel duidelijk zijn dat ik op de een of andere manier niet bij het signature veld kom... Ik heb zelf niet zo veel ervaring/kennis van notes/domino dus wellicht dat ik iets over het hoofd zie wat een doorgewinterde notes/domino programmeur direct ziet?!

GC.Collect();


Acties:
  • 0 Henk 'm!

  • raptorix
  • Registratie: Februari 2000
  • Laatst online: 17-02-2022
Ik zou even een breakpoint op regel 16 zetten en dan het object inspecteren...

Acties:
  • 0 Henk 'm!

  • D2k
  • Registratie: Januari 2001
  • Laatst online: 02-09 11:02

D2k

Ik vraag me alleen even af waarom je het in C doet en niet vanuit lotusscript in het postopen event van de mailfiles?


gebruik ook notespeek ff

Ik vond hier nog wat waar je misschien wat aan hebt:

http://searchdomino.techt...4_gci1214488_mem1,00.html
QUESTION POSED ON: 06 September 2006

How can I modify Lotus Notes mail preferences (change the signature) using LotusScript?

>

Such preferences are stored in a profile document in the Lotus Notes user's mailbox. To change them programmatically, simple use the following code:

Dim Preferences As notesdocument
Set Preferences = MailBox.GetProfileDocument
("CalendarProfile")

Where "MailBox" points to the Lotus Notes user's mail database. If you are running the code within the mail database, this is done by calling:

Dim session as new notesSession
Dim mailbox as notesDatabase
Set MailBox=Session.CurrentDatabase

Otherwise, use the Formula language command @MailDbname or methods of the LotusScript object NotesRegistration to find the user's Lotus Notes mail file.

Once you have the profile document, you will need to either point it to an HTML signature file to add the signature text directly into the profile document. To use an external HTML document (which must exist on every machine where the mailfile is used), set the "SignatureOption" field to "2" and put the pathname of the Lotus Notes signature file in the Signature_1 field.

To store a signature in the profile itself, set "SignatureOption" to "1" and enter the text in the field "Signature_1". When you are done, be sure to call the save method on the profile document.

Incidentally, I figured this out a while back by looking at my own mail file in Domino Designer and examining the "Tools\Preferences" action on the "$Inbox" folder, which led to the "(Preferences)" agent, and then to the "Calendar Profile" form.

Doet iets met Cloud (MS/IBM)