Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5949595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:16:20+00:00 2026-05-22T17:16:20+00:00

We’re currently developing a plug-in for a piece of software in C#. This plug-in

  • 0

We’re currently developing a plug-in for a piece of software in C#. This plug-in extracts the contents of a PST file and stores all items in it as text files (with the exception of attachments, which are stored as their type in the same folder as the email).

It has been working without issue until we tested it on Windows 7 w/ Outlook 2K7. After running the same previous job on a machine with Outlook 2000 on it, we noticed that there were over 12,000 files missing. These files turned out to be attachments (mostly URLs)

We found that the issue is that Outlook 2K7 blocks attachments with specific extensions. If you open the email in Outlook itself, you see a blue bar at the top stating “Outlook blocked access to the following potentially unsafe attachments” and all the attachments in the emails.

Is there a way to programmatically get these attachments without Outlook blocking them?

The code we use to save the attachments is:

private void saveAttachment(ref object oEmail, StoreInfo currentStoreInfo, string sEmailID, string sExportPath)
{

   int iAttachCount = 0;
   object oAttach = null;
   oAttach = getNextAttachment(oEmail, ref iAttachCount);

   while (oAttach != null)
   {
      saveAttachment(sEmailID, sExportPath, oAttach);
      oAttach = getNextAttachment(oEmail, ref iAttachCount);
   }

} 

private object getNextAttachment(object oEmail, ref  int iAttachCount)
{
   object oAttach = null;

   try
   {
      iAttachCount++;
      oAttach = GetProperty(oEmail, "Attachments", new object[] { iAttachCount });
   }
   catch //(Exception ex)
   {
      // There was no attachment to be gotten
      oAttach = null;
   }
   return oAttach;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:16:20+00:00Added an answer on May 22, 2026 at 5:16 pm

    Just putting this on here in case anybody else runs into the same issue. Outlook 2K7 has a Level1 file type feature that blocks access to attachments with specific extensions.

    However, you can change the registry to allow access to these files. Just remember to set it back to the way it was prior to you modifying it for security’s sake.

    private void SetLevel1RemoveValues()
    
        {
            // Get the base key for the current user HKEY_CURRENT_USER
            Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.CurrentUser, "");
            // Get the security key from the registry
            Microsoft.Win32.RegistryKey subKey = regKey.OpenSubKey("Software\\Microsoft\\Office\\" + sCurrentOutlookVersion + ".0\\Outlook\\Security", true);
    
            // If the Outlook\Security key doesn't exit, create one
            if (subKey == null)
                subKey = regKey.CreateSubKey("Software\\Microsoft\\Office\\" + sCurrentOutlookVersion + ".0\\Outlook\\Security");
    
            // Loop through each Value in the registry to see if the Level1Remove key already exists.
            string[] sValues = subKey.GetValueNames();
    
            bool bHasLevel1RemoveKey = false;
            foreach (string sValue in sValues)
                if (sValue == "Level1Remove")
                    bHasLevel1RemoveKey = true;
    
            // If the key already exists, store the data so we can reset it later
            if (bHasLevel1RemoveKey)
                sPrevLevel1RemoveValues = subKey.GetValue("Level1Remove").ToString();
            else
                sPrevLevel1RemoveValues = "";
    
            // Create an array of all Level 1 Extensions
            string[] level1Extensions = new string[] { ".ade", ".adp", ".app", ".asp", ".bas", ".bat", 
                ".cer", ".chm", ".cmd", ".com", ".cpl", ".crt", ".csh", ".exe", ".fxp", ".gadget", 
                ".hlp", ".hta", ".inf", ".ins", ".isp", ".its", ".js", ".jse", ".ksh", ".lnk", 
                ".mad", ".maf", ".mag", ".mam", ".maq", ".mar", ".mas", ".mat", ".mau", ".mav", ".maw", 
                ".mda", ".mdb", ".mde", ".mdt", ".mdw", ".mdz", ".msc", ".msi", ".msp", ".mst", ".ops", 
                ".pcd", ".pif", ".pfr", ".prg", ".pst", ".reg", ".scf", ".scr", ".sct", ".shb", ".shs", 
                ".tmp", ".url", ".vb", ".vbe", ".vbs", ".vsmacros", ".vss", ".vst", ".vsw", 
                ".ws", ".wsc", ".wsf", ".wsh" };
    
            // Set the value in the registry to the list of all Level 1 extensions so we can extract them
            subKey.SetValue("Level1Remove", string.Join(";", level1Extensions));
    
            // Close (and save) the values
            subKey.Close();
            regKey.Close();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.