Beantwortet Outlook.Items types

  • Mittwoch, 8. August 2012 12:58
     
     

    how can i tell the type of each item in Outlook.Items?

    thanks..

Alle Antworten

  • Mittwoch, 8. August 2012 13:10
     
     

    depending on language, but usually you should check Class or MessageClass

  • Donnerstag, 9. August 2012 05:26
     
     
    can u give an example in c#?
  • Donnerstag, 9. August 2012 09:33
     
     Beantwortet Enthält Code

    usually you care only for specific types on messages , so for example if you want only to process mailitems in Items collection, you should do something like that in c#:

    for (int i =1; i<= Items.Count; i++)
    {
    MailItem mail = Items[i] as MailItem;
    if(mail == null)
    continue;
    // here process mail
    }

  • Donnerstag, 9. August 2012 10:55
     
     Beantwortet Enthält Code

    i tried somthing like this:

    for (int i = 1; i <= Items.Count; i++)
    {
      if (!(((int)OlObjectClass.olMail).Equals(Items[i].Class)))
      {
          continue;
      }
      //rest of code
    }

    what's better?


  • Donnerstag, 9. August 2012 11:19
     
     
    if you need to work with mailitem object anyway so you need to cast anyway, you are just postponing ineviteable.
  • Donnerstag, 9. August 2012 12:51
     
     
    do you know how to write the code in delphi?
  • Donnerstag, 9. August 2012 14:31
     
     
    no, too hard, only vba oneliners.