I almost forgot to share with you the final solution of this problem, this
are the 2 functions needed:
using nov=System.Reflection.Missing;
// Get the index of selected label for the appointment
private int getLabel(AppointmentItem actividad)
{
MAPI.Session ses = new MAPI.Session();
ses.Logon(nov.Value, nov.Value, false, false, nov.Value,
nov.Value, nov.Value);
MAPI.Message mens =
(MAPI.Message)ses.GetMessage(actividad.EntryID, nov.Value);
MAPI.Fields campos = (MAPI.Fields)mens.Fields;
MAPI.Field campo = (MAPI.Field)campos.get_Item("0x8214",
"0220060000000000C000000000000046");
int label = int.Parse(campo.Value.ToString());
ses.Logoff();
return label;
}
// Retur the label text according with the index passed
private string setLabel(int numero)
{
string etiqueta = "";
switch (numero)
{
case 1:
etiqueta = "PLANEACIÓN Y SEGUIMIENTO";
break;
case 2:
etiqueta = "ANÃLISIS";
break;
case 3:
etiqueta = "DISEÑO";
break;
case 4:
etiqueta = "DESARROLLO";
break;
case 5:
etiqueta = "REPROCESO";
break;
case 6:
etiqueta = "PRUEBAS";
break;
case 7:
etiqueta = "INVESTIGACIÓN Y CAPACITACIÓN";
break;
case 8:
etiqueta = "DESPLIEGUE Y SOPORTE AL CLIENTE";
break;
case 9:
etiqueta = "INTERRUPCIONES";
break;
case 10:
etiqueta = "Personal";
break;
}
return etiqueta;
}
To get the appointment Label, just install CDO 1.2.1 from Microsoft, add a
reference to the project and use this function call:
string label="";
label=setLabel(getLabel(appointmentObject));
Just change the code inside the switch in the setLabel function, to work
according to your Outlook label definitions.