Ver Mensaje Individual
  #1  
Antiguo 07-01-2016
Avatar de pacopenin
pacopenin pacopenin is offline
Miembro
 
Registrado: sep 2010
Ubicación: Asturias
Posts: 382
Reputación: 14
pacopenin Va por buen camino
Chequear el valor de una variable OleVariant

Estoy encabezonado con un problemilla que no se resolver.

Os explico. Es una automatización Ole para buscar un correo enviado mediante Outlook.

Código Delphi [-]
var
  ol : OutlookXP.TOutLookApplication;
  ns : OutlookXP.NameSpace;
  fdOutbox : OutlookXP.MAPIFolder;

  MyUserProperty: OutlookXP.UserProperty;

  ItemOL, Prop, props, myInsp, myRef: OLEVariant;
  x : String;
  b : Boolean;
  vt : TVarType;
begin

.....

   ol := OutlookXP.TOutLookApplication.Create(nil);
   ns := ol.GetNamespace('MAPI');
   try
    fdOutbox := ns.GetDefaultFolder(olFolderSentMail);

    if fdOutbox.Items <> nil then
     if fdOutbox.Items.Count > 0  then
      begin
       try
         myInsp := fdOutbox.Items.Find('[Campo De Busqueda]=' + quotedStr('Valor de Busqueda'));

//         b := myInsp = nada;

//         x := format('%p', [myInsp]);
//         x := VarToStr(myInsp);

//         x:= OleVariantToString(myInsp);

//         if (@myInsp <> @myRef) then

          if VarIsNull(myInsp) OR VarIsEmpty(myInsp) then
           mensaje('No encontrado mensaje ' + IntToStr(id))
          else
           saveEMail(myInsp);
       finally
         myInsp := VarNull;
       end;
      end;
   except
     on E: SysUtils.Exception do
      begin
       MostrarError('Se produjo un error al recuperar el correo enviado.', E.Message);
       raise;
      end;
   end;

La variable myInsp toma el valor $00000000 cuando no encuentra el valor buscado, pero no soy capaz de poner una condición para chequear eso. No puedo pasarlo a string, ni a entero... incluso hice una búsqueda de un elemento que no puede existir y lo comparaba. Nada, que no doy con ello.

Se os ocurre algo?
__________________
http://www.gestionportable.com
Responder Con Cita