How can one get rid off the Security Warning dialog box which pops up when you try to access a property of ContactItem in Outlook 2003
I'm using Visual Studio Team Suite Beta 2, Microsoft Outlook 11.0 Object Library, Outlook 2003. I've written a webform to get the list of contacts and display it in a listbox. But everytime the webform loads, an outlook security dialog box pops up. I'm not sure if this is the right forum but I couldn't find another one specifically for Outlook 2003 programming.
Here's the code.
protected void Page_Load(object sender, EventArgs e)
{
Outlook.
Application app = new Outlook.Application();Outlook.
NameSpace ns = app.GetNamespace("MAPI");Outlook.
MAPIFolder contactlist = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);Outlook.
Items oItems = contactlist.Items;Outlook.
ContactItem oCt = (Outlook.ContactItem)oItems.GetFirst(); while (oCt != null){
ContactsListBox.Items.Add(oCt.Email1Address);
oCt = (Outlook.
ContactItem)oItems.GetNext();}
}
// Gets the selected contacts from the listbox and displays it in a textbox
protected void AddToButton_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder(); foreach (ListItem li in ContactsListBox.Items){
if (li.Selected){
sb.Append(li.Text);
sb.Append(
",");}
}
ToTextBox.Text = sb.ToString();
}Thanks in advance,
shiversticks

how to turn off outlook security warning dialog box using C#
Shan McArthur
1) The DistListItem object has a GetMember method that you can use to iterate all the items in the DL, returning each as a Recipient object.
2) That depends on how the user responds to the first such prompt. For protected address properties and methods, the user can suppress additional prompts for up to 10 minutes.
vbpixelgog
Hi Rajesh,
I wasn't able to get around the security warning dialog box. According to the previous posts, I believe if you have Visual Studio Tools for Office (VSTO) 2005, it has a project called Outlook add-in under Office projects. When you create an outlook add-in using that, it will not give the security dialog. Right now, I'm modifying my solution to let my users create different address lists by presenting them a webform to do so. Then I'm saving the addresses in Sql Server and letting the users access addresses through it. It would have been great if I could have gotten around the dialog box instead of doing it this way. I wish I could get my hands on VSTO 2005. Hope this helps.
-shiversticks
Regis M
thanks in advance,
Rajesh
ignatandrei
If an application that is not recognized requests information or tries to add information to the system or use the SDK at all even, then Quickbooks pops up a dialog asking if you want access. Fine and dandy, it should. But there is also a checkbox to tell Quickbooks to remember that specific application and not ask again.
This simple addition to the stupid security dialog makes interacting with Outlook useful again and maintains security restrictions intelligently. All that would be missing is a manager that allows you to remove things from the list of memorized applications if you wanted built in with a GUI to shows you those that you have allowed.
Simple, and effective. Right now the whole system is crippled and thus essentially useless without Redemption.
CiTiZEN
I'm using this scenario right now and IT STILL PROMPTS EVERY TIME.
I hope they fix it the way I suggest. Cause it's a PITA right now and just a stupid solution to a problem. But then the security stuff in Vista proves that MS still doesn't get it regarding security anyhow, so I'm not hopeful.
japm
Just be sure you understand the security implications. Namely, once Redemption is available on a system, any code can then use it to access the Outlook object model bypassing the warning.
You can find Redeption here: http://www.dimastr.com/redemption/
Todd532002
Hi...
i was searching for the same subject... i'm using MS Outlook 2003 and i'm trying to write a console program to send e-mails using Outlook object but still get annoyed by security prompts.
i tried to use the trusted code as the following lines for accessing Outlook as in Minimizing Object Model Guard Warnings
this.CreateItem(thnx
Robert W. Anderson
Sunil
However, there are supported ways to avoid the security dialog in other types of applications. For example, if you use Visual Studio 2005 Tools for the Microsoft Office System to create an add-in, objects used that were acquired from the Outlook.Application object our tools instantiate for you will not cause the security prompt to appear.
The basic principle is that too many users have been impacted because of viruses and other intrusions. The security dialog is there to preserve the integrity of Outlook security. Yes, it can be annoying. But, it is less annoying than losing one's inbox or the inboxes of an entire company.
HTH,
John.
sujith
Benlbit
Thanks for your responses. I'm trying to change my strategy accordingly. I have a couple of related questions.
1. What are the methods that we can use to get a list of email addresses from a group email in outlook For example, if the user has an emailgroup in his address book called "friendslist" and has 5 email addresses inside it, how can we extract those 5 addresses by just selecting the group address How do we select the group address
2. This is with respect to the security model again. If we try to access the email group "friendslist", would the security warning pop up 5 times or (will it pop up just once but will allow us to get all the 5 addresses)
I hope I'm clear in my questions. Rough day here :(
Thanks in advance,
shiversticks
digidigi77
Outlook add-ins can avoid displaying the security warning dialog box by obtaining references to Outlook objects from the trusted Application object. If you create a new Application object in your code, this object and any other Outlook objects you obtain from it are not trusted, and will display the security warning dialog box.
How you obtain the trusted Application object depends on the type of Outlook add-in you are creating. If you are creating a COM Outlook add-in that implements the IDTExtensibility2 interface, then you should use the Application object that your add-in receives from the OnConnection method. For more information, see the topic "What's New in Microsoft Office Outlook 2003 for Developers " at http://www.msdn.microsoft.com/office/default.aspx pull=/library/en-us/odc_ol2003_ta/html/odc_olwhatsnew2k3.asp, specifically under the heading "Revised and Improved Security Model".
If you are creating an Outlook add-in using Visual Studio 2005 Tools for Applications, then you should use the ThisApplication object provided by the project template. For more information, see "Specific Security Considerations for Office Solutions" at http://msdn2.microsoft.com/library/1thd35d7(en-US,VS.80).aspx, specifically under the heading "Minimizing Object Model Guard Warnings".
I hope this helps,
McLean Schofield
Casino Game Developer
NaudePaul