none
differentiating emails in sent items and inbox RRS feed

  • Question

  •  

    Hello all,

     

    im developing an outlook plugin that sends emails data to a DB when a button is clicked. i need to fnd a way to differenciate the emails in the inbox and sent items. The problem is the plugin will be used on outlooks that run with different languages. do i cant rely on the the folder name because of the outlook language is not english, sent items' name wont be the same.

     

    any ideas???

    Wednesday, November 7, 2007 4:24 PM

Answers

  • Then just check the the Parent of the MailItem

     

    parentFolder = mailItem.Parent as Outlook.MAPIFolder;

     

    if (parentFolder == inboxFolder)...

     

    etc.

     

    Hope this helps,

    greets, Helmut

    Wednesday, November 7, 2007 6:56 PM
    Answerer
  • Thx a million Helmut

    u are a life saver Big Smile

     

    t didnt work but this did

     

    if (parentFolder.FullFolderPath == sentItemsFolder.FullFolderPath)

     

     

    thx again for ur help....

    Wednesday, November 7, 2007 7:26 PM

All replies

  • Hi Murad,

     

    this should work for all Outlook versions...

     

    Outlook.MAPIFolder inboxFolder = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

    Outlook.MAPIFolder sentItemsFolder = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);

     

     

    Hope this helps,

    greets, Helmut

     

    Wednesday, November 7, 2007 5:53 PM
    Answerer
  •  

    thx Helmut,

     

    but wouldnt this get me which folder is the default one?

    Wednesday, November 7, 2007 6:05 PM
  • Hello Murad,

     

    it depends on what exactly you want to archive when you click your button.

    I assume it is something like this.

    The user selects a Folder and clicks your Button.

    Now you wnat to know if the user selected the inbox or sent items folder ?

     

    You can get the current selected folder with :

     

    Outlook.MAPIFolder selectedFolder = Application.ActiveExplorer().CurrentFolder;

     

    Then you can say:

     

    if (selectedFolder == inboxFolder)...

     

    if (selectedFolder == sentItemsFolder)...

     

    Hope this helps,

    greets, Helmut

    Wednesday, November 7, 2007 6:10 PM
    Answerer
  •  

    Actually no,

     

    the user will select an email and press on the button. I need to know if that specific email the user selected is in the inbox or the sent items, using a method other than the folder name (because apparently folder names change accordng to the outlook's language)

     

    can u help wth this?

    thx again Smile

    Wednesday, November 7, 2007 6:13 PM
  • Then just check the the Parent of the MailItem

     

    parentFolder = mailItem.Parent as Outlook.MAPIFolder;

     

    if (parentFolder == inboxFolder)...

     

    etc.

     

    Hope this helps,

    greets, Helmut

    Wednesday, November 7, 2007 6:56 PM
    Answerer
  • Thx a million Helmut

    u are a life saver Big Smile

     

    t didnt work but this did

     

    if (parentFolder.FullFolderPath == sentItemsFolder.FullFolderPath)

     

     

    thx again for ur help....

    Wednesday, November 7, 2007 7:26 PM