Guest User

Untitled

a guest
Dec 16th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. //tell the app where the 32 and 64 bit dlls are located
  6. //by default, they are assumed to be in the same folder as the current assembly and be named
  7. //Redemption.dll and Redemption64.dll.
  8. //In that case, you do not need to set the two properties below
  9. RedemptionLoader.DllLocation64Bit = @"Redemption/redemption64.dll";
  10. RedemptionLoader.DllLocation32Bit = @"Redemption/redemption.dll";
  11. //Create a Redemption object and use it
  12. RDOSession session = RedemptionLoader.new_RDOSession();
  13.  
  14. session.Logon(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
  15.  
  16. var stores = session.Stores;
  17. foreach (RDOStore rdoStore in stores)
  18. {
  19. if (rdoStore.Name.Contains("michael"))
  20. {
  21. var folderId = rdoStore.RootFolder.EntryID;
  22. PerformMailFix(folderId, session);
  23. }
  24.  
  25. }
  26. Console.WriteLine(count);
  27. Console.ReadKey();
  28. session.Logoff();
  29.  
  30. }
  31.  
  32. private static int count = 0;
  33. private static void PerformMailFix(string folderId, RDOSession session)
  34. {
  35. var folder = session.GetFolderFromID(folderId);
  36.  
  37. if (folder.FolderKind == rdoFolderKind.fkSearch)
  38. return;
  39.  
  40. var before=new DateTime(2014,06,30);
  41. foreach (RDOMail item in folder.Items)
  42. {
  43. if (item.ReceivedTime >= before) continue;
  44. var diff = item.ReceivedTime - item.SentOn;
  45. if (!(diff.TotalHours > 10)) continue;
  46. Console.WriteLine("" + item.Subject + " - " + item.ReceivedTime + " " + item.SentOn);
  47. count++;
  48. item.ReceivedTime = item.SentOn;
  49. item.Save();
  50. }
  51.  
  52. Console.WriteLine(folder.DefaultMessageClass);
  53. //do the same fix for all subfolders
  54. foreach (RDOFolder subFolder in folder.Folders)
  55. {
  56. PerformMailFix(subFolder.EntryID, session);
  57. }
  58.  
  59. }
  60. }
Add Comment
Please, Sign In to add comment