Outlook Attachment is not working when I "open" RRS feed

  • Question

  • I develop a small tools (C# console application) to open certain file extension (*.DRF) with my application. I create registry for the extention and added shell->command and tells to execute my program to open .DRF file.  Everything is working fine as I expected with registry settings by my application. Only exception is, if the file is attached to outlook email, and user click on the attachment, if user save the file and try to open, it works. But if user click on Open, it does not trigger my application. 

    Initially I thought because my code was not signed, and outlook detects that my application is not from a trusted publisher, its causing this. So I bought code sign digital certificate and install the certificate in my code, reinstall the setup.exe but no luck. I can see in Outlook trusted publisher that the company name I gave for the tools, is now a trusted publisher but still its not triggering my application.exe to open the file. 

    Also I opened the outlook temporary directory in Windows explorer where outlook save the file before open it. And I copied a file with .DRF into that location and try to open the it in by double click and its not opening the file. So windows has some security setup for that temp folder which is preventing my the file.DRF to trigger my exe to open it. 

    Any help would be appreciable. 

    Friday, May 25, 2018 7:48 PM

All replies

  • Hello,

    VSTO doesn't provide anything for that.

    It is not clear what exactly windows registry keys were added and where. Have you tried adding a file extension association using the Control Panel applet instead of adding windows registry keys?

    See How To Change Default Programs (File Associations) To Open Attachments In Outlook? for more information. Does it work correctly in that case?

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Saturday, May 26, 2018 6:13 PM
  • The file association in control panel is showing right program that I wrote and its working when I try to open a .DRF file direct from any other folder except the outlook temp folder. I manually even change the default program to open .DRF file using my program. But no luck. 

    As for registry change, I add .DRF in registry and tells windows which program to use to open the .DRF file. 

    Tuesday, May 29, 2018 3:45 AM
  • Hello,

    This forum is for development issue related to Visual Studio Tools for Office and I think your issue is more related to Outlook Object Model. So I will move the thread to Outlook IT Pro Discussions.

    Thanks for understanding,

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 29, 2018 6:34 AM
  • Hi newbiesaspnet,

    >> The file association in control panel is showing right program that I wrote and its working when I try to open a .DRF file direct from any other folder except the outlook temp folder.

    How about right clicking the .DRF file in the outlook temp folder and choose Open with to see if the file can be open using your application?

    Besides, could you please share the detailed registry value you modified then we can try do further research on this.


    Yuki Sun

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Tuesday, May 29, 2018 9:18 AM
  • Hi Yuki Sun

    As I have mentioned in my original post last paragraph, the file does not open by right click or double click  if the .DRF file in the outlook temp folder. It opens if the file is anywhere else. 

    Here is the registry settings I modified:

    1. HKEY_CLASSES_ROOT/.DRF -->(Default) DrfFile

    2. HKEY_CLASSES_ROOT/DrfFile/shell/open/command-->(Default) "C:\Program Files(x86)\ConsoleApplication1\ConsoleApplication1.exe" %1

    Tuesday, May 29, 2018 12:33 PM