1

I am having trouble remembering my Outlook PST password, and cannot import that file into Outlook 2016. I have tried several forums, free password recovery software tools, but could not reset/recover the password. After browsing a lot, I found out Aspose.Email for .NET has a backdoor to access the properties of PST file and there's a way to reset password. I have no idea about this, and have never used .NET or C#. Is there someone who can help me out here?

Following are the related links from my browsing results:

Aspose.Email for .NET - https://dzone.com/articles/how-to-check-set-remove-or-update-password-of-pst

PST Password Property - https://msdn.microsoft.com/en-us/library/ff385916(v=office.12).aspx

Please note my PST is UNICODE and not ANSI format, so following is already out of question. http://www.itninja.com/blog/view/how-to-unlock-password-protected-pst-file-6

This is what I have tried online @https://dotnetfiddle.net/:

using System;
using Aspose.Email.Mapi;
using Aspose.Email.Storage.Pst;


namespace Aspose.Email.Examples.CSharp.Email.Outlook
{
    class RemovingPaswordProperty
    {
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:RemovingPaswordProperty
            string dataDir = RunExamples.GetDataDir_Outlook();
            PersonalStorage personalStorage = PersonalStorage.FromFile(dataDir + "PersonalStorage1.pst");
            if (personalStorage.Store.Properties.ContainsKey(MapiPropertyTag.PR_PST_PASSWORD))
            {
                MapiProperty property = new MapiProperty(MapiPropertyTag.PR_PST_PASSWORD, BitConverter.GetBytes((long)0));
                personalStorage.Store.SetProperty(property);
            }
            // ExEnd:RemovingPaswordProperty
        }
    }
}

and I am getting following errors:

Error(s): Compilation error (line 14, col 30): The name 'RunExamples' does not exist in the current context

Sagar
  • 2,778
  • 1
  • 8
  • 16
  • if you have no idea about c# - learning some basics would be your best bet – BugFinder Oct 10 '17 at 14:56
  • I have attempted to do that, and ran the code snippets online, but cannot figure out the errors. Its more than learning basics in this case. – Sagar Oct 10 '17 at 14:59
  • then post your code and the errors - stackoverflow is not here to write it all for you – BugFinder Oct 10 '17 at 15:00
  • I have been answering a lot of question on SO myself, and I completely agree with you. But, I find it redundant, as the link already has code that I am referring/running. – Sagar Oct 10 '17 at 15:01
  • If you want the help you will need to post the code and the errors – BugFinder Oct 10 '17 at 15:03
  • @BugFinder, hellyale - I was hesitating to put the code out, as the online compiler I was using earlier was showing the errors on each line when I was hovering my mouse on each statement. I didn't want to put a snapshot of that as that would be a bad practice. I found this other online compiler that is showing errors separately. Please help. – Sagar Oct 10 '17 at 15:14
  • Thanks @hellyale, but I do not have admin rights on my machine. I have tried that already. Could you please take a look a the the updated code, and suggest anything? – Sagar Oct 10 '17 at 15:55
  • Okay. I tried as suggested, and it seems all errors have been fixed. But I am getting `Fatal Error: Public Main() method is required in a public class`. – Sagar Oct 10 '17 at 16:09
  • I am still getting the same error response. – Sagar Oct 10 '17 at 17:25
  • I changed the `RemovingPaswordProperty` `class` to `public` too; and, receiving a run-time exception now. `Run-time exception (line -1): The type initializer for '' threw an exception. Stack Trace: [System.Security.SecurityException: Request failed.] [System.TypeInitializationException: The type initializer for '' threw an exception.]` .NET Fiddle Link: https://dotnetfiddle.net/yhau2e – Sagar Oct 10 '17 at 17:47
  • Looks like it is not able to access the directory path due to security policies. – Sagar Oct 10 '17 at 18:06
  • I was able to remove password from my PST using `Aspose.Email for Java` and can access my emails in Outlook. Reference: https://github.com/aspose-email/Aspose.Email-for-Java – Sagar Oct 10 '17 at 20:26
  • @Sagar, Were you able to resolve the issue for .NET example? If no, please post us with your query on [Aspose.Email forum](https://forum.aspose.com/c/email). We can provide you with a sample console application for example. – Kashif Iqbal Nov 06 '17 at 16:55
  • @KashifIqbal - Thanks for pointing me to the right forum. But, I was able to reset password using Aspose.Email for Java. It was a one-time problem, so not looking for any further solutions at this point of time. – Sagar Nov 06 '17 at 20:16

0 Answers0