Advertisement
Guest User

Untitled

a guest
Dec 4th, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using Microsoft.Win32;
  11. using System.IO;
  12.  
  13. namespace OutlookWFA
  14. {
  15. public partial class Form1 : Form
  16. {
  17. public Form1()
  18. {
  19. InitializeComponent();
  20. }
  21.  
  22. private void Form1_Load(object sender, EventArgs e)
  23. {
  24. if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\16.0") != null)
  25. {
  26. object outlook16 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\16.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
  27. Empty(outlook16.ToString());
  28. if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
  29. {
  30. this.Close();
  31. }
  32. }
  33. else if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\15.0") != null)
  34. {
  35. object outlook13 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\15.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
  36. Empty(outlook13.ToString());
  37. if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
  38. {
  39. this.Close();
  40. }
  41. }
  42. else if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\14.0") != null)
  43. {
  44. object outlook10 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\14.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
  45. Empty(outlook10.ToString());
  46. if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
  47. {
  48. this.Close();
  49. }
  50. }
  51. else if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\12.0") != null)
  52. {
  53. object outlook07 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\12.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
  54. Empty(outlook07.ToString());
  55. if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
  56. {
  57. this.Close();
  58. }
  59. }
  60. else if (Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\11.0") != null)
  61. {
  62. object outlook03 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\11.0\Outlook\Security").GetValue("OutlookSecureTempFolder");
  63. Empty(outlook03.ToString());
  64. if (MessageBox.Show("Success! The folder has been cleared!") == DialogResult.OK)
  65. {
  66. this.Close();
  67. }
  68. }
  69. else
  70. {
  71. MessageBox.Show("ERROR! \nCould not find Outlook 2003 - 2016 on this Machine.", "Outlook Not Detected");
  72. this.Close();
  73. }
  74.  
  75. }
  76. public void Empty(string path)
  77. {
  78. DirectoryInfo dir = new DirectoryInfo(System.IO.Path.GetDirectoryName(path));
  79. foreach (System.IO.FileInfo file in dir.GetFiles())
  80. {
  81. file.Delete();
  82. }
  83. foreach (System.IO.DirectoryInfo subDirectory in dir.GetDirectories())
  84. {
  85. subDirectory.Delete(true);
  86. }
  87. }
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement