Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find Item In Outlook (VB6 - Automating Outlook)

    I'm trying to find an item in Outlook where the message body meets certain criteria. The item will be in a shared folder rather than the users default mailbox. I've got so far...

    Dim cOutlook As CEMail
    Dim cMailFolder As Outlook.MAPIFolder
    Dim olMailItem As Outlook.MailItem

    '// Create the outlook item to initialise outlook
    Set cOutlook = New CEMail

    '// Try and create a reference to the 'Shared Marketing' MAPI folder
    Set cMailFolder = cOutlook.OutlookNameSpace.Folders.Item("Mailbox - Shared Marketing")

    So once I've created my mail folder obect, I can use the 'Find' method to search that particular folder. The item I want to find would have a unique ID in the message body, say 44506. I'm stuck on the syntax to use to search the message body for this ID?

    '// Now start searching the folders for the selected campaign ID
    Set olMailItem = cMailFolder.Items.Find ????????

    Any Ideas??

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Find Item In Outlook (VB6 - Automating Outlook)

    I don't think you canuse the Find method for this - others will correct me if I'm wrong. The Find method of an Items collection expects a Filter:<blockquote><hr>Filter: Required String. An expression that will evaluate to True or False.

    The filter is a string expression containing one or more filter clauses joined by the logical operators And, Not and Or.

    A filter clause is a simple expression that evaluates to True or False; for example, [CompanyName] = "Microsoft".

    Note that property names can be used in the expression and are identified and delimited by square brackets. Except for these bracketed property names, only literals are allowed within the expression

  3. #3
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find Item In Outlook (VB6 - Automating Outlook)

    Hans,

    I'll be implementing your code as my search, I was hoping to do it in 1 line is all - lazy Monday morning coding...!!

    Thanks for your response.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •