none
how to know if user add attachements in a mail RRS feed

  • Question

  • Hi,all,

    I want to know if the user add attachments in a mail.

           So I get the attachments object, and want to use get_Account() function to get the result.

           But there is a problem.  if user have a signature in mail setting, the account value is not right when user really do not add an attachment.

           Any suggestion would be appreciated.

           thanks.

    Wednesday, July 17, 2013 8:53 AM

Answers

  • Count, you wanted to get number of attachments :)Going back to your problem - i think you are talking about situation when attachments collection shows that there are some attachments but in UI you do not see any - if that is the case then it is expected: embedded images (used sometimes in signatures) are stored as attachments and will appear in that collection. If you want to count only 'visible' attachments, you must check each one for PR_ATTACH and PR_CONTENTID properties (http://schemas.microsoft.com/mapi/proptag/0x37140003 and http://schemas.microsoft.com/mapi/proptag/0x3712001E). pr_contentid should not start with "cid:" value

    • Marked as answer by SaraZC Monday, July 22, 2013 9:04 AM
    Thursday, July 18, 2013 7:24 AM
  • Other properties can also indicate a hidden attachment. If PR_HIDE_ATTACH is set the attachment will be hideen, the SmartNoAttach property on the item indicates either a signature or a contact picture.

    PR_HIDE_ATTACH = http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B

    SmartNoAttach = http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B


    Ken Slovak MVP - Outlook

    • Marked as answer by SaraZC Monday, July 22, 2013 9:04 AM
    Thursday, July 18, 2013 2:33 PM
    Moderator

All replies

  • i do not recally any Account property on attachment interface. can you show us some code?
    Wednesday, July 17, 2013 1:03 PM
  • // get current attachments object
    CComQIPtr<Outlook::Attachments> spAtcmts;
    spMailItem->get_Attachments(&spAtcmts);
    ATLASSERT(NULL != spAtcmts);
    
    // get the count of attachment
    long lAtcmtsAccout = 0;
    spAtcmts->get_Count(&lAtcmtsAccout);

    Thursday, July 18, 2013 2:13 AM
  • Count, you wanted to get number of attachments :)Going back to your problem - i think you are talking about situation when attachments collection shows that there are some attachments but in UI you do not see any - if that is the case then it is expected: embedded images (used sometimes in signatures) are stored as attachments and will appear in that collection. If you want to count only 'visible' attachments, you must check each one for PR_ATTACH and PR_CONTENTID properties (http://schemas.microsoft.com/mapi/proptag/0x37140003 and http://schemas.microsoft.com/mapi/proptag/0x3712001E). pr_contentid should not start with "cid:" value

    • Marked as answer by SaraZC Monday, July 22, 2013 9:04 AM
    Thursday, July 18, 2013 7:24 AM
  • Other properties can also indicate a hidden attachment. If PR_HIDE_ATTACH is set the attachment will be hideen, the SmartNoAttach property on the item indicates either a signature or a contact picture.

    PR_HIDE_ATTACH = http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B

    SmartNoAttach = http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B


    Ken Slovak MVP - Outlook

    • Marked as answer by SaraZC Monday, July 22, 2013 9:04 AM
    Thursday, July 18, 2013 2:33 PM
    Moderator