| 
                
         | 
  
  
        | 
				                                 Michael Bendtsen                				 
                					 
                     
                
                
                
                                 
                 
                
                
                                 
                                        Posts: 58 
                                                        Joined: 2007-06-27 
                                                
         | 
        
                
                
                I have installed my addin using the setup project in Visual Studio on a Client machine. The setup file registers the secman.dll and a AutomationInterface which is called from an ActiveX component. Through debug code I can see that when the code is trying to load the SecurityManager, 
 AddinExpress.Outlook.SecurityManager manager = new AddinExpress.Outlook.SecurityManager(); 
 the installation begins. If I let this continue or cancel the operation the code is completed as expected.
                  |   
                 
         | 
  
  
        
                
                
                  
						| 
				                Posted 28 Dec, 2007 09:42:21
						 | 
                        
                                
                                
                                                                                                
                         | 
                        
                                                                Top
                         | 
                   
                 
                 
         | 
  
    
        | 
				                                 Sergey Grischenko                				 
                					 					 
                
                
                
                 Add-in Express team                 
                 
                
                
                                 
                                        Posts: 7233 
                                                        Joined: 2004-07-05 
                                                
         | 
        
                
                
                Hi Michael.
 
 Did you include the SecurityManager.dll assembly in the setup project?
 Do run the application under the same system account which you have used to install the application?                 |   
                 
         | 
  
  
        
                
                
                  
						| 
				                Posted 28 Dec, 2007 11:33:47
						 | 
                        
                                
                                
                                                                                                
                         | 
                        
                                                                Top
                         | 
                   
                 
                 
         | 
  
    
        | 
				                                 Michael Bendtsen                				 
                					 
                     
                
                
                
                                 
                 
                
                
                                 
                                        Posts: 58 
                                                        Joined: 2007-06-27 
                                                
         | 
        
                
                
                Hi Sergey
 
 Thanks. This worked.
 
 Now I have another problem. The method that uses the SecurityManager fails the second time it is called.
 
 The error is:
 Courier
 
 The Code:
 [FONT=Courier]
      public void NewEMail(...)
      {
          Trace.WriteLine("NewEmail");
          Trace.WriteLine("  Instanciate SecurityManager");
          AddinExpress.Outlook.SecurityManager manager = new AddinExpress.Outlook.SecurityManager();
          Trace.WriteLine("  Get Outlook.ApplicationClass");
          Outlook.Application OutlookApp = new Outlook.ApplicationClass();
          Outlook.MailItem mail = null;
          try
          {
              if (OutlookApp != null)
              {
                  Trace.WriteLine("  Connecting to " + OutlookApp.Name);
                  manager.ConnectTo(OutlookApp);
                  manager.DisableOOMWarnings = true;
                  Trace.WriteLine("  Creating item");
                  mail = (Outlook.MailItem)OutlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
                  mail.Subject = subject;
                  ...
                  Trace.WriteLine("  Displays E-mail");
                  mail.Display(false);
              }
          }
          catch (Exception ex)
          {
              LoggingManager.Log(ex);
          }
          finally
          {
              if (manager != null)
              {
                  manager.DisableOOMWarnings = false;
                  manager.Dispose();
              }
              if (mail != null)
                  Marshal.ReleaseComObject(mail);
              if (OutlookApp != null)
                  Marshal.ReleaseComObject(OutlookApp);
          }
      }[/FONT]                  |   
                 
         | 
  
  
        
                
                
                  
						| 
				                Posted 02 Jan, 2008 04:14:40
						 | 
                        
                                
                                
                                                                                                
                         | 
                        
                                                                Top
                         | 
                   
                 
                 
         | 
  
    
        | 
				                                 Sergey Grischenko                				 
                					 					 
                
                
                
                 Add-in Express team                 
                 
                
                
                                 
                                        Posts: 7233 
                                                        Joined: 2004-07-05 
                                                
         | 
        
                
                
                Hi Michael. 
 
 Please try to create a global instance of the SecurityManager class once and use this reference in the method. I think it should help.                 |   
                 
         | 
  
  
        
                
                
                  
						| 
				                Posted 02 Jan, 2008 08:58:45
						 | 
                        
                                
                                
                                                                                                
                         | 
                        
                                                                Top
                         | 
                   
                 
                 
         | 
  
    
        | 
				                                 Michael Bendtsen                				 
                					 
                     
                
                
                
                                 
                 
                
                
                                 
                                        Posts: 58 
                                                        Joined: 2007-06-27 
                                                
         | 
        
                
                | 
                Should I Connect and disconnect every time I uses it? or only connect once in the ctor?                 |   
                 
         | 
  
  
        
                
                
                  
						| 
				                Posted 02 Jan, 2008 09:02:05
						 | 
                        
                                
                                
                                                                                                
                         | 
                        
                                                                Top
                         | 
                   
                 
                 
         | 
  
    
        | 
				                                 Michael Bendtsen                				 
                					 
                     
                
                
                
                                 
                 
                
                
                                 
                                        Posts: 58 
                                                        Joined: 2007-06-27 
                                                
         | 
        
                
                
                It works. I do not dispose the SecurityManager object and I connect every time I uses the object.
 
 Thanks alot.                 |   
                 
         | 
  
  
        
                
                
                  
						| 
				                Posted 02 Jan, 2008 09:32:21
						 | 
                        
                                
                                
                                                                                                
                         | 
                        
                                                                Top
                         | 
                   
                 
                 
         | 
  
    
        | 
				                                 Sergey Grischenko                				 
                					 					 
                
                
                
                 Add-in Express team                 
                 
                
                
                                 
                                        Posts: 7233 
                                                        Joined: 2004-07-05 
                                                
         | 
        
                
                | 
                Michael, you can connect once. You just need to disable and enable the security in the method.                 |   
                 
         | 
  
  
        
                
                
                  
						| 
				                Posted 02 Jan, 2008 09:53:05
						 | 
                        
                                
                                
                                                                                                
                         | 
                        
                                                                Top
                         | 
                   
                 
                 
         |