Security Manager v809 - proper using

Add-in Express™ Support Service
That's what is more important than anything else

Security Manager v809 - proper using
 
Sergej Loos




Posts: 5
Joined: 2017-12-22
Hello,

I'm trying to use the SecurityManager .NET (c #) and have problems in our application when many emails are sent (serial mailer).
I suspect that I use the manager incorrectly. Please clarify the following questions:

- Can multiple instances of the SecurityManager be created?
- Can I use multiple instances of the Outlook.Application with only one SecurityManager?
- Can I first call "SecurityManager.DisableOOMWarnings = true "and then
"SecurityManager.ConnectTo(application)"?
- Can multiple instances of the application run at the same time? Do they collide with each other?
What if many users on one terminal server work with the application?

Best regards, Sergey Loos
Posted 22 Dec, 2017 06:35:58 Top
Andrei Smolin


Add-in Express team


Posts: 15208
Joined: 2006-05-11
Hello Sergey,

Microsoft doesn't allow you to have several instances of Outlook in a given Windows (terminal) session. Outlook instances running in different terminal sessions don't interfere.

To be able to modify DisableOOMWarnings, the component must be connected to an Outlook.Application object. You may have several instances of your application and Security Manager should work correctly in this case.

If you have a specific issue, please let me know.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Dec, 2017 06:50:30 Top
Sergej Loos




Posts: 5
Joined: 2017-12-22
Hello Andrei,

in that case I did everything right. My code for serial mailing (I created a new instance of SecurityManager every time):

foreach (..)
{
AddinExpress.Outlook.SecurityManager manager = null;
try {
Outlook.Application application = new Outlook.Application();
manager = new AddinExpress.Outlook.SecurityManager();
manager.ConnectTo(application);
manager.DisableOOMWarnings = true;

Outlook.MailItem mailItem = (Outlook.MailItem)application.CreateItem(Outlook.OlItemType.olMailItem);

// set properties of mailItem and send email
// ..


}
finally {
manager.DisableOOMWarnings = false;
manager.Dispose();
}
}

After about 40 emails I got the exception:
The 'secman.OutlookSecurityManager' COM object is not registered.
bei AddinExpress.Outlook.SecurityManager.ConnectTo(Object outlookApp)
Posted 22 Dec, 2017 08:48:09 Top
Sergej Loos




Posts: 5
Joined: 2017-12-22
Hello, I have now run your sample application and I get the security queries from Outlook even though the SecurityManager is being used. Das ist die Anwendung: "outlook-security-manager-samples-v8\NET\C#.NET\SendMail"
Posted 22 Dec, 2017 09:17:55 Top
Andrei Smolin


Add-in Express team


Posts: 15208
Joined: 2006-05-11
Hello Sergej,

Rewrite your code as follows:
- start Outlook and set up Security Manager outside of the loop
- in the loop, create emails and send them
- after the loop ends, enable warnings, dispose Seucrity Manager, call Outlook.Application.Quit.

Sergej Loos writes:
Das ist die Anwendung: "outlook-security-manager-samples-v8\NET\C#.NET\SendMail"


Install Outlook Security Manager 8.10; see https://www.add-in-express.com/downloads/osm.php.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Dec, 2017 10:33:55 Top
Sergej Loos




Posts: 5
Joined: 2017-12-22
After the update, I have the following error:

System.Runtime.InteropServices.COMException (0x80004005): Beim Aufruf einer COM-Komponente wurde ein HRESULT E_FAIL-Fehler zurückgegeben.
bei AddinExpress.Outlook.IOutlookSecurityManager2.Check(Int32 apiType)
bei AddinExpress.Outlook.SecurityManager.set_DisableOOMWarnings(Boolean value)
Posted 22 Dec, 2017 11:03:16 Top
Sergej Loos




Posts: 5
Joined: 2017-12-22
Sergej Loos writes:
System.Runtime.InteropServices.COMException (0x80004005): Beim Aufruf einer COM-Komponente wurde ein HRESULT E_FAIL-Fehler zurückgegeben. bei AddinExpress.Outlook.IOutlookSecurityManager2.Check(Int32 apiType) bei AddinExpress.Outlook.SecurityManager.set_DisableOOMWarnings(Boolean value)



Sorry, my mistake, I forgot to call ConnectTo
Posted 22 Dec, 2017 11:17:23 Top
Andrei Smolin


Add-in Express team


Posts: 15208
Joined: 2006-05-11
No problem!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Dec, 2017 06:57:43 Top