Search code examples
c#outlookoutlook-redemption

Redemption Class not registered


I am using REdemption To add a new mailbox account in Outlook . Below is my code.

private static void CreateAccount()
    {

        var app = new Outlook.Application();
        var Session = new Redemption.RDOSession(); // Generates Exception
        Session.MAPIOBJECT = app.Session.MAPIOBJECT;
        var Accounts = Session.Accounts;
        var POP3Account = Accounts.AddPOP3Account("Joe The User", "upwork.demo@cgsny.net", "outlook.office365.com", "   smtp.office365.com", "currentUser", "pwd");
        POP3Account.SMTP_UseAuth = true;
        POP3Account.SMTP_LogonKind = rdoSMTPLogonKind.lkSameAsIncoming;
        POP3Account.SMTP_Port = 1025;
        POP3Account.LeaveMessagesOnServer = true;
        POP3Account.DeleteFromServerAfterXDays = true;
        POP3Account.DaysBeforeDelete = 30;
        POP3Account.Save();
    }

On the line where I am creating New RDOSession I get this Exception stating that the class Is not registered .

I have tried Registering class through Redemption Installer and manually throguh regsvr32.exe as well.

Any suggetions


Solution

  • I was able to fix the problem by changing the bitness of my app to match the bitness of redemption and outlook installed . You can do that in you project's properties window build tab . Changing the target version to DESIRED one in my case it was x64 . Initially is will be set to any CPU