1
votes

I have a small VS C# program that modifies some data from an email signature on HTML format that will be used later in Lotus Notes 8.5.3 Each user is able to generate his own .html file filled with his personal data from the common template.

My problem is that now I would like the software to save the .html file on Lotus Notes Data directory and then configure the client to use that specific signature without the user having to go through the menues "More-->Preferences-->Signature" himself.

Here is my code so far:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace FirmaCorreo
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void ListBox_SelectionChanged(object sender,  SelectionChangedEventArgs e)
        {

        }

        private void Generar_Click(object sender, RoutedEventArgs e)
        {
            string suSaludo;
            suSaludo = Texto1.Text;
            string suNombre;
            suNombre = Texto2.Text;
            string suCargo;
            suCargo = Texto3.Text;
            string suCargo2;
            suCargo2 = Texto4.Text;
            string suMovil;
            suMovil = Texto5.Text;
            string suDirecto;
            suDirecto = Texto6.Text;
            string suDelegacion;
            if (DelegacionVillajoyosa.IsChecked == true)
            {
                suDelegacion = "Villajoyosa";
            }
            else if (DelegacionCanarias.IsChecked == true)
            {
                suDelegacion = "Canarias";
            }
            else if (DelegacionVigo.IsChecked == true)
            {
                suDelegacion = "Vigo";
            }
            else
            {
                suDelegacion = "Francia";
            }
            var contents = System.IO.File.ReadAllText(@"C:\Users\Public\Documents\IS-IT\FirmaCorreo\Plantilla\Plantillacorreo.html", Encoding.GetEncoding(28591));
            contents = contents.Replace("<!--Saludo-->", suSaludo);
            contents = contents.Replace("<!--NombreDelEmpleado-->", suNombre);
            contents = contents.Replace("<!--CargoDelEmpleado-->", suCargo);
            contents = contents.Replace("<!--CargoDelEmpleado2-->", "<br />"+suCargo2);
            contents = contents.Replace("<!--TelefonoMovil-->", "Mobile.- "+suMovil);
            contents = contents.Replace("<!--TelefonoDirecto-->", "<br />Direct.- "+suDirecto);
            contents = contents.Replace("<!--Delegacion"+suDelegacion, "<!-- -->");
            System.IO.File.WriteAllText(@"C:\Users\Public\Documents\IS-IT\FirmaCorreo\Plantilla\PlantillacorreoModificada.html", contents, Encoding.GetEncoding(28591));
        }

    }
}

On my Lotus Notes 8.5.3 installation I see a notes.ini file which seems to have the signature configuration:

...
$SigSet=1
$SigState=1
$SigSetValue=1
....
$tmpStrFilter=HTML File
$tmpSigPath=C:\Lotus\Notes\Data\FirmaCorreo\FirmaPedro.html
...

Notes allows three different options for mail signatures: Rich Text - Plain Text - HTML or Image File I thought maybe I just had to edit notes.ini on each client to set up the resulting HTML file from my program. The problem is notes.ini doesn't change when I change the type of signature on my client.

Is there any way to get the resulting HTML file to be the default signature on Lotus Notes without asking each user to go to the Preferences menu and select the right settings? Can I have my C# program do that for them?

1

1 Answers

1
votes

The html file path is stored in a profile document in the Mail database called $CalendarProfile and the field Signature2

You might be able hook into Notes using Microsoft COM objects(windows) and read the document, but then the code need to run on the client machine using the users password.

Another approach can be to create a lotusscript that updates the profile when user open the mailfile for the first time, this can be done once by changing the mail template and pushing it out to all users.

Keep in mind that a signature referenced to local disk will not work in webmail