I'm new here, and I'm hoping someone can help me out...
I'm creating an ActiveX control for an company intranet. This control needs to access Microsoft Outlook (specifically the user's contacts folders). I have created a script that can do this, and have also managed to get an activeX control running.
However, when I try to use my Outlook script within my ActiveX control I get a System.Security.Permissions.SecurityPermissions error. I'm assuming that the local machine is not allowing the activeX control to open the outlook folders...
I am able to modify registry keys or outlook/internet explorer configuration on any of the computers that will run the app, but I'm wondering what setting I have to change to grant the activeX control permission to access the outlook folders...
Here is the basic code I am using the access Microsoft Outlook (I am trying to wrap the functionality I need within a class that inherits from System.Windows.Forms.UserControl in order to use a managed ActiveX Control):
Expand|Select|Wrap|Line Numbers
- Outlook._Application App = new Outlook.Application();
- Outlook._NameSpace NS = App.GetNamespace("MAPI");
- NS.Logon(null, null, false, false);
- Outlook.MAPIFolder Contacts = NS.GetDefaultFolderOutlook.OlDefaultFolders.olFolderContacts);
- foreach (Outlook._ContactItem Contact in Contacts.Items)
- {
- Console.WriteLine(Contact.LastName);
- }
- Loren Van Spronsen