![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Can anyone help explain the following... we have an application which uses
the Outlook object model to send emails. We are therefore pretty up to speed with Outlook securty templates and CheckAdminSettings, i.e they are enabled. In debugging security, I created a sample VB6 app to send a test email. I thought I was going mad in my first attempt (method #3 here) whereby nothing I seemed to do with the security template could prevent the popup dialog occuring when the line: MailItem.Recipients.Add ") was executed in method #3. As I knew we *could* send email, I checked the existing code in two applications. In the first application, it created the recipient using NameSpace.CreateRecipient. The second application, it created the mail item in in the MAPI inbox and the added recipients in the same way. In both cases (methods 1 and 2), the security dialog doesn't appear - controlled via "When accessing address information via Outlook Object Model" switch in the template. So I guess the question is - why does: Dim Namespace As Outlook.Namespace Set Namespace = OutlookApp.GetNamespace("MAPI") Dim MailItem As Outlook.MailItem Set MailItem = OutlookApp.CreateItem(olMailItem) Dim Recipient As Outlook.Recipient Set Recipient = ") and Dim Namespace As Outlook.Namespace Set Namespace = OutlookApp.GetNamespace("MAPI") Dim Inbox As Outlook.MAPIFolder Set Inbox = Namespace.GetDefaultFolder(olFolderInbox) Dim MailItem As Outlook.MailItem Set MailItem = Inbox.Items.Add MailItem.Recipients.Add ") NOT trigger the popup (i.e. the security template is acted upon) whereas: Dim MailItem As Outlook.MailItem Set MailItem = OutlookApp.CreateItem(olMailItem) MailItem.Recipients.Add ") DOES trigger the popup, i.e. the security template is ignored. I'm guessing it something to do with the context in which the recipients are added. In the working cases, this is (kind of) under the MAPI namespace whereas the failing case, the mailitem is created directly under the Outlook.Application. Cheers, Rob. ' The code... #If Method = 1 Then Dim OutlookApp As New Outlook.Application OutlookApp.Session.Logon , , , True Dim Namespace As Outlook.Namespace Set Namespace = OutlookApp.GetNamespace("MAPI") Dim MailItem As Outlook.MailItem Set MailItem = OutlookApp.CreateItem(olMailItem) Dim Recipient As Outlook.Recipient Set Recipient = ") MailItem.Recipients.Add Recipient MailItem.Subject = "Testing Outlook security" MailItem.Body = "1-2-3" MailItem.Send #End If #If Method = 2 Then Dim OutlookApp As New Outlook.Application OutlookApp.Session.Logon , , , True Dim Namespace As Outlook.Namespace Set Namespace = OutlookApp.GetNamespace("MAPI") Dim Inbox As Outlook.MAPIFolder Set Inbox = Namespace.GetDefaultFolder(olFolderInbox) Dim MailItem As Outlook.MailItem Set MailItem = Inbox.Items.Add MailItem.Recipients.Add ") MailItem.Subject = "Testing Outlook security" MailItem.Body = "1-2-3" MailItem.Send #End If #If Method = 3 Then Dim OutlookApp As New Outlook.Application OutlookApp.Session.Logon , , , True Dim MailItem As Outlook.MailItem Set MailItem = OutlookApp.CreateItem(olMailItem) MailItem.Recipients.Add ") MailItem.Subject = "Testing Outlook security" MailItem.Body = "1-2-3" MailItem.Send #End If End Sub |
Ads |
#2
|
|||
|
|||
![]()
Hmm, further bit of madness, change method #3 (the failing one) to:
#If Method = 3 Then Dim OutlookApp As New Outlook.Application OutlookApp.Session.Logon , , , True Dim MailItem As Outlook.MailItem Set MailItem = OutlookApp.CreateItem(olMailItem) MailItem.Subject = "Testing Outlook security" MailItem.Body = "1-2-3" MailItem.Recipients.Add ") MailItem.Send #End If i.e. add the recipients AFTER setting up the subject and body and guess what - it works, no security dialog. So WTF does it change if the add recipients is before setting up subject and body. Tell me that!!! Cheers, Rob. "Rob Nicholson" wrote in message ... Can anyone help explain the following... we have an application which uses the Outlook object model to send emails. We are therefore pretty up to speed with Outlook securty templates and CheckAdminSettings, i.e they are enabled. In debugging security, I created a sample VB6 app to send a test email. I thought I was going mad in my first attempt (method #3 here) whereby nothing I seemed to do with the security template could prevent the popup dialog occuring when the line: MailItem.Recipients.Add ") was executed in method #3. As I knew we *could* send email, I checked the existing code in two applications. In the first application, it created the recipient using NameSpace.CreateRecipient. The second application, it created the mail item in in the MAPI inbox and the added recipients in the same way. In both cases (methods 1 and 2), the security dialog doesn't appear - controlled via "When accessing address information via Outlook Object Model" switch in the template. So I guess the question is - why does: Dim Namespace As Outlook.Namespace Set Namespace = OutlookApp.GetNamespace("MAPI") Dim MailItem As Outlook.MailItem Set MailItem = OutlookApp.CreateItem(olMailItem) Dim Recipient As Outlook.Recipient Set Recipient = ") and Dim Namespace As Outlook.Namespace Set Namespace = OutlookApp.GetNamespace("MAPI") Dim Inbox As Outlook.MAPIFolder Set Inbox = Namespace.GetDefaultFolder(olFolderInbox) Dim MailItem As Outlook.MailItem Set MailItem = Inbox.Items.Add MailItem.Recipients.Add ") NOT trigger the popup (i.e. the security template is acted upon) whereas: Dim MailItem As Outlook.MailItem Set MailItem = OutlookApp.CreateItem(olMailItem) MailItem.Recipients.Add ") DOES trigger the popup, i.e. the security template is ignored. I'm guessing it something to do with the context in which the recipients are added. In the working cases, this is (kind of) under the MAPI namespace whereas the failing case, the mailitem is created directly under the Outlook.Application. Cheers, Rob. ' The code... #If Method = 1 Then Dim OutlookApp As New Outlook.Application OutlookApp.Session.Logon , , , True Dim Namespace As Outlook.Namespace Set Namespace = OutlookApp.GetNamespace("MAPI") Dim MailItem As Outlook.MailItem Set MailItem = OutlookApp.CreateItem(olMailItem) Dim Recipient As Outlook.Recipient Set Recipient = ") MailItem.Recipients.Add Recipient MailItem.Subject = "Testing Outlook security" MailItem.Body = "1-2-3" MailItem.Send #End If #If Method = 2 Then Dim OutlookApp As New Outlook.Application OutlookApp.Session.Logon , , , True Dim Namespace As Outlook.Namespace Set Namespace = OutlookApp.GetNamespace("MAPI") Dim Inbox As Outlook.MAPIFolder Set Inbox = Namespace.GetDefaultFolder(olFolderInbox) Dim MailItem As Outlook.MailItem Set MailItem = Inbox.Items.Add MailItem.Recipients.Add ") MailItem.Subject = "Testing Outlook security" MailItem.Body = "1-2-3" MailItem.Send #End If #If Method = 3 Then Dim OutlookApp As New Outlook.Application OutlookApp.Session.Logon , , , True Dim MailItem As Outlook.MailItem Set MailItem = OutlookApp.CreateItem(olMailItem) MailItem.Recipients.Add ") MailItem.Subject = "Testing Outlook security" MailItem.Body = "1-2-3" MailItem.Send #End If End Sub |
#3
|
|||
|
|||
![]()
Can anyone help explain the following... we have an application which uses
*Cough* MSDN validation poster - isn't somebody official supposed to reply :-) Yes, I know it's hard grin Rob. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
reset up internet security in outlook | dominic m cutaia | Outlook - Installation | 0 | February 26th 06 02:51 PM |
Outlook+Norton Internet Security=0x800CCC0F | [email protected] | Outlook - General Queries | 4 | February 23rd 06 06:04 PM |
Outlook Security Settings | JamesRussel | Outlook - General Queries | 3 | January 26th 06 01:28 PM |
Outlook security | Claude Amyotte | Outlook - General Queries | 4 | January 24th 06 05:57 PM |