Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using Microsoft.Win32;
- using System.IO;
- namespace OutlookWFA
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\16.0") != null)
- {
- object outlook16 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\16.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
- Empty(outlook16.ToString());
- if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
- {
- this.Close();
- }
- }
- else if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\15.0") != null)
- {
- object outlook13 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\15.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
- Empty(outlook13.ToString());
- if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
- {
- this.Close();
- }
- }
- else if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\14.0") != null)
- {
- object outlook10 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\14.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
- Empty(outlook10.ToString());
- if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
- {
- this.Close();
- }
- }
- else if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\12.0") != null)
- {
- object outlook07 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\12.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
- Empty(outlook07.ToString());
- if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
- {
- this.Close();
- }
- }
- else if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\11.0") != null)
- {
- object outlook03 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\11.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
- Empty(outlook03.ToString());
- if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
- {
- this.Close();
- }
- }
- else
- {
- MessageBox.Show("ERROR! \nCould not find Outlook 2003 - 2016 on this Machine.", "Outlook Not Detected");
- this.Close();
- }
- }
- public void Empty(string path)
- {
- DirectoryInfo dir = new DirectoryInfo(System.IO.Path.GetDirectoryName(path));
- foreach (System.IO.FileInfo file in dir.GetFiles())
- {
- file.Delete();
- }
- foreach (System.IO.DirectoryInfo subDirectory in dir.GetDirectories())
- {
- subDirectory.Delete(true);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement