MS Office Forum / Outlook / Programming Add-Ins / February 2004
[Redemption] Failed To Resolve SafeRecipients In SafeAppointmentItem
|
|
Thread rating:  |
Michael Zino - 24 Feb 2004 08:42 GMT Hello,
I am developing an Outlook addin using Redemption. I am trying to add recipients to the Outlook AppointmentItem as follows:
Dim oSafeAppointment As Object
Set oSafeAppointment = CreateObject("Redemption.SafeAppointmentItem") oSafeAppointment.Item = m_oAppointmentItem 'Note: m_oAppointmentItem was retrieved from OOM
'The following is not working; "Resource1" and "Resource2" are being added to the appointment but can't be resolved oSafeAppointment.Resources = "Resource1;Resource2" oSafeAppointment.Recipients.ResolveAll
'The following is not working as well Set oSafeRecipient = oSafeAppointment.Recipients.Add("Resource1") oSafeRecipient.Type = olResource oSafeRecipient.Resolve 'The problem is that "Resource1" isn't being added to the appointment
"Resource1" and "Resource2 exist and are being resolved automatically when they are being added manually through the Outlook UI or when using the following code:
m_oAppointmentItem.Resources = "Resource1;Resource2" m_oAppointmentItem.Recipients.ResolveAll 'succeeded with security alerts
Additionally, when I am using MAPIUtils and creating SafeRecipient--"Resource1" is resolved. But it can't help me, and I wrote it just to make sure that the problem is not Exchange related:
Dim oSafeRecipient As SafeRecipient Dim oUtils As Object
Set oUtils = CreateObject("Redemption.MAPIUtils") Set oSafeRecipient = oUtils.CreateRecipient("Resource1") If oSafeRecipient.Resolved = True Then Debug.Print oSafeRecipient.Name & "Resolved=True; Address=" & oSafeRecipient.Address End If
Please advise.
Regards, Michael Zino
Sue Mosher [MVP-Outlook] - 24 Feb 2004 12:25 GMT You must resolve the recipient before you can set the Type. Does this work better:
Set oSafeRecipient = oSafeAppointment.Recipients.Add("Resource1") oSafeRecipient.Resolve oSafeRecipient.Type = olResource
 Signature Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx
> Hello, > [quoted text clipped - 43 lines] > Regards, > Michael Zino Michael Zino - 24 Feb 2004 13:32 GMT Hello Sue,
Thank's for your help.
As I commented in my previous post, using this code doesn't add the resource to the appointment at all.
However, I changed the order in which I assigned the type of the recipient as you suggested, but still got nothing. The resource is not being added to the appointment (SafeAppointmentItem).
The only way I succeeded to add the resource to the appointment (when using Redemption) is by using the following code:
m_oSafeAppointment.Resources = "Resource1" m_oSafeAppointment.Recipients.ResolveAll
But when using this concept, the resource (or the recipient) is not being resolved, although I explicitly invoked the ResolveAll method.
Thanks, Michael Zino
You must resolve the recipient before you can set the Type. Does this work better:
Set oSafeRecipient = oSafeAppointment.Recipients.Add("Resource1") oSafeRecipient.Resolve oSafeRecipient.Type = olResource
 Signature Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx
> Hello, > [quoted text clipped - 16 lines] > oSafeRecipient.Type = olResource > oSafeRecipient.Resolve 'The problem is that "Resource1" isn't being added to
> the appointment > [quoted text clipped - 7 lines] > Additionally, when I am using MAPIUtils and creating > SafeRecipient--"Resource1" is resolved. But it can't help me, and I wrote it
> just to make sure that the problem is not Exchange related: > [quoted text clipped - 12 lines] > Regards, > Michael Zino Ken Slovak - [MVP - Outlook] - 24 Feb 2004 16:01 GMT If you look in the Object Browser at the Redemption SafeAppointmentItem you will see that .Resources is a read-only string, so you can't directly set that property.
Have you tried setting the recipients you are adding and want to be resources as Bcc recipients? According to the Help resources are added as Bcc recipients.
 Signature Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginners Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
> Hello Sue, > [quoted text clipped - 18 lines] > Thanks, > Michael Zino Michael Zino - 25 Feb 2004 08:34 GMT Dear Ken,
The Class property of the Redemption's SafeRecipient is read-only as well. However, I tried the following code:
Dim oSafeRecipient As Object Set oSafeRecipient = m_oSafeAppointment.Recipients.Add("Resource1") oSafeRecipient.Class = 3 ' BCC oSafeRecipient.Resolve
And still, the recipient wasn't added to the AppointmentItem at all. The only way, I succeeded to add the "non-resolved" recipient only by using the Resources property.
Regards, Michael Zino
If you look in the Object Browser at the Redemption SafeAppointmentItem you will see that .Resources is a read-only string, so you can't directly set that property.
Have you tried setting the recipients you are adding and want to be resources as Bcc recipients? According to the Help resources are added as Bcc recipients.
 Signature Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginners Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
> Hello Sue, > > Thank's for your help. > > As I commented in my previous post, using this code doesn't add the resource
> to the appointment at all. > > However, I changed the order in which I assigned the type of the recipient
> as you suggested, but still got nothing. > The resource is not being added to the appointment (SafeAppointmentItem).
> The only way I succeeded to add the resource to the appointment (when using
> Redemption) is by using the following code: > > m_oSafeAppointment.Resources = "Resource1" > m_oSafeAppointment.Recipients.ResolveAll > > But when using this concept, the resource (or the recipient) is not being
> resolved, although I explicitly invoked the ResolveAll method. > > Thanks, > Michael Zino Dmitry Streblechenko \(MVP\) - 24 Feb 2004 17:33 GMT How do you know that the resources cannot be resolved? After resolving, can you access Recipient.Address and Recipient.EntryID properties? Note that Outlook will not reflect in its UI any changes made through anything but the Outlook Object Model until you completely dereference and reopen thne object. Is m_oAppointmentItem displayed at the time your code is executed?
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
> Hello, > [quoted text clipped - 43 lines] > Regards, > Michael Zino Michael Zino - 25 Feb 2004 08:20 GMT Dear Dmitry,
After resolving, the Recipient.Address and Recipient.EntryID are both empty strings. I am sure that this is a resolving issue, as the added resource is not underlined and there is no free / busy information. If I am using Tools | Check Names, the resource is resolved.
My addin is manipulating the current AppointmentItem, which is currently being displayed by the Outlook UI.
I tried to add SafeRecipient into the SafeRecipients collection of the SafeAppointmentItem, and to completely dereference and reopen the object and still the SafeRecipient wasn't added to the appointment item.
Additionally, I am wondering how I can access the SafeAppointmentItem's Resources property, although it is read only property. It seems that the only way of adding resources to the SafeAppointmentItem is by using the Resources property, as other methods don't work at all.
Regards, Michael Zino
How do you know that the resources cannot be resolved? After resolving, can you access Recipient.Address and Recipient.EntryID properties? Note that Outlook will not reflect in its UI any changes made through anything but the Outlook Object Model until you completely dereference and reopen thne object. Is m_oAppointmentItem displayed at the time your code is executed?
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
> Hello, > [quoted text clipped - 16 lines] > oSafeRecipient.Type = olResource > oSafeRecipient.Resolve 'The problem is that "Resource1" isn't being added to
> the appointment > [quoted text clipped - 7 lines] > Additionally, when I am using MAPIUtils and creating > SafeRecipient--"Resource1" is resolved. But it can't help me, and I wrote it
> just to make sure that the problem is not Exchange related: > [quoted text clipped - 12 lines] > Regards, > Michael Zino Dmitry Streblechenko \(MVP\) - 25 Feb 2004 17:10 GMT Are you saying that the code below produces an empty address?
set Recip = SafeAppointment.Recipients.Add("resource1") Recip.Resolve(TRUE) MsgBox Recip.EntryID
Also note that SafeAppointmentItem.Resources is readonly because OOM blocks reading of this property, writing is not blocked, hence you can set the Resources property on the original OOM AppointmentItem without a security prompt.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
> Dear Dmitry, > [quoted text clipped - 79 lines] > > Regards, > > Michael Zino Michael Zino - 25 Feb 2004 19:25 GMT Yes indeed. Additionally, the recipient itself won't be added to the underlying unsafe appointment item. The only way I succeeded to add the recipient in a way that it will be reflected in the Outlook UI, is by using the Resources property. But in this case, the added resource is not resolve. Regards, Michael Zino
"Dmitry Streblechenko (MVP)" <dmitry@dimastr.com> wrote in message news:#sM7NJ8#DHA.2636@TK2MSFTNGP09.phx.gbl... Are you saying that the code below produces an empty address?
set Recip = SafeAppointment.Recipients.Add("resource1") Recip.Resolve(TRUE) MsgBox Recip.EntryID
Also note that SafeAppointmentItem.Resources is readonly because OOM blocks reading of this property, writing is not blocked, hence you can set the Resources property on the original OOM AppointmentItem without a security prompt.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"Michael Zino" <mvidas@mercury.co.il> wrote in message news:u8qw0g3%23DHA.2476@TK2MSFTNGP12.phx.gbl... > Dear Dmitry, > > After resolving, the Recipient.Address and Recipient.EntryID are both empty > strings. > I am sure that this is a resolving issue, as the added resource is not > underlined and there is no free / busy information. > If I am using Tools | Check Names, the resource is resolved. > > My addin is manipulating the current AppointmentItem, which is currently > being displayed by the Outlook UI. > > I tried to add SafeRecipient into the SafeRecipients collection of the > SafeAppointmentItem, and to completely dereference and reopen the object and > still the SafeRecipient wasn't added to the appointment item. > > Additionally, I am wondering how I can access the SafeAppointmentItem's > Resources property, although it is read only property. > It seems that the only way of adding resources to the SafeAppointmentItem is > by using the Resources property, as other methods don't work at all. > > Regards, > Michael Zino > > "Dmitry Streblechenko (MVP)" <dmitry@dimastr.com> wrote in message > news:OIzsYxv#DHA.2012@TK2MSFTNGP11.phx.gbl... > How do you know that the resources cannot be resolved? After resolving, can > you access Recipient.Address and Recipient.EntryID properties? Note that > Outlook will not reflect in its UI any changes made through anything but the > Outlook Object Model until you completely dereference and reopen thne > object. Is m_oAppointmentItem displayed at the time your code is executed? > > Dmitry Streblechenko (MVP) > http://www.dimastr.com/ > OutlookSpy - Outlook, CDO > and MAPI Developer Tool > > > "Michael Zino" <mvidas@mercury.co.il> wrote in message > news:uEUx4Mr%23DHA.2292@TK2MSFTNGP12.phx.gbl... > > Hello, > > > > I am developing an Outlook addin using Redemption. > > I am trying to add recipients to the Outlook AppointmentItem as follows: > > > > Dim oSafeAppointment As Object > > > > Set oSafeAppointment = CreateObject("Redemption.SafeAppointmentItem") > > oSafeAppointment.Item = m_oAppointmentItem > > 'Note: m_oAppointmentItem was retrieved from OOM > > > > 'The following is not working; "Resource1" and "Resource2" are being added > > to the appointment but can't be resolved > > oSafeAppointment.Resources = "Resource1;Resource2" > > oSafeAppointment.Recipients.ResolveAll > > > > 'The following is not working as well > > Set oSafeRecipient = oSafeAppointment.Recipients.Add("Resource1") > > oSafeRecipient.Type = olResource > > oSafeRecipient.Resolve 'The problem is that "Resource1" isn't being added > to > > the appointment > > > > "Resource1" and "Resource2 exist and are being resolved automatically when > > they are being added manually through the Outlook UI or when using the > > following code: > > > > m_oAppointmentItem.Resources = "Resource1;Resource2" > > m_oAppointmentItem.Recipients.ResolveAll 'succeeded with security alerts > > > > Additionally, when I am using MAPIUtils and creating > > SafeRecipient--"Resource1" is resolved. But it can't help me, and I wrote > it > > just to make sure that the problem is not Exchange related: > > > > Dim oSafeRecipient As SafeRecipient > > Dim oUtils As Object > > > > Set oUtils = CreateObject("Redemption.MAPIUtils") > > Set oSafeRecipient = oUtils.CreateRecipient("Resource1") > > If oSafeRecipient.Resolved = True Then > > Debug.Print oSafeRecipient.Name & "Resolved=True; Address=" & > > oSafeRecipient.Address > > End If > > > > Please advise. > > > > Regards, > > Michael Zino
Dmitry Streblechenko \(MVP\) - 25 Feb 2004 20:40 GMT That's weird. Does it happen for *any* recipient name or just for some? What is the exact string that you pass to Recipients.Add? Since you can create a valid recipient using MAPIUtils.CreateRecipient, you can simply copy the resolved properties to the Recipient returned by Recipients.Add:
Recip1.Fields(PR_ENTRYID) = Recip2..Fields(PR_ENTRYID) etc for the PR_ADDRTYPE, PR_DISPLAY_NAME, PR_EMAIL_ADDRESS properties.
Another workaround is to add the recipients using AppointmentItem.Resources property, then programmatically execute (Tools|Check Names) since the inspector is displayed:
set btn = inspector.commandbars.FindControl(1, 361) btn.Execute Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
Yes indeed. Additionally, the recipient itself won't be added to the underlying unsafe appointment item. The only way I succeeded to add the recipient in a way that it will be reflected in the Outlook UI, is by using the Resources property. But in this case, the added resource is not resolve. Regards, Michael Zino
"Dmitry Streblechenko (MVP)" <dmitry@dimastr.com> wrote in message news:#sM7NJ8#DHA.2636@TK2MSFTNGP09.phx.gbl... Are you saying that the code below produces an empty address?
set Recip = SafeAppointment.Recipients.Add("resource1") Recip.Resolve(TRUE) MsgBox Recip.EntryID
Also note that SafeAppointmentItem.Resources is readonly because OOM blocks reading of this property, writing is not blocked, hence you can set the Resources property on the original OOM AppointmentItem without a security prompt.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"Michael Zino" <mvidas@mercury.co.il> wrote in message news:u8qw0g3%23DHA.2476@TK2MSFTNGP12.phx.gbl... > Dear Dmitry, > > After resolving, the Recipient.Address and Recipient.EntryID are both empty > strings. > I am sure that this is a resolving issue, as the added resource is not > underlined and there is no free / busy information. > If I am using Tools | Check Names, the resource is resolved. > > My addin is manipulating the current AppointmentItem, which is currently > being displayed by the Outlook UI. > > I tried to add SafeRecipient into the SafeRecipients collection of the > SafeAppointmentItem, and to completely dereference and reopen the object and > still the SafeRecipient wasn't added to the appointment item. > > Additionally, I am wondering how I can access the SafeAppointmentItem's > Resources property, although it is read only property. > It seems that the only way of adding resources to the SafeAppointmentItem is > by using the Resources property, as other methods don't work at all. > > Regards, > Michael Zino > > "Dmitry Streblechenko (MVP)" <dmitry@dimastr.com> wrote in message > news:OIzsYxv#DHA.2012@TK2MSFTNGP11.phx.gbl... > How do you know that the resources cannot be resolved? After resolving, can > you access Recipient.Address and Recipient.EntryID properties? Note that > Outlook will not reflect in its UI any changes made through anything but the > Outlook Object Model until you completely dereference and reopen thne > object. Is m_oAppointmentItem displayed at the time your code is executed? > > Dmitry Streblechenko (MVP) > http://www.dimastr.com/ > OutlookSpy - Outlook, CDO > and MAPI Developer Tool > > > "Michael Zino" <mvidas@mercury.co.il> wrote in message > news:uEUx4Mr%23DHA.2292@TK2MSFTNGP12.phx.gbl... > > Hello, > > > > I am developing an Outlook addin using Redemption. > > I am trying to add recipients to the Outlook AppointmentItem as follows: > > > > Dim oSafeAppointment As Object > > > > Set oSafeAppointment = CreateObject("Redemption.SafeAppointmentItem") > > oSafeAppointment.Item = m_oAppointmentItem > > 'Note: m_oAppointmentItem was retrieved from OOM > > > > 'The following is not working; "Resource1" and "Resource2" are being added > > to the appointment but can't be resolved > > oSafeAppointment.Resources = "Resource1;Resource2" > > oSafeAppointment.Recipients.ResolveAll > > > > 'The following is not working as well > > Set oSafeRecipient = oSafeAppointment.Recipients.Add("Resource1") > > oSafeRecipient.Type = olResource > > oSafeRecipient.Resolve 'The problem is that "Resource1" isn't being added > to > > the appointment > > > > "Resource1" and "Resource2 exist and are being resolved automatically when > > they are being added manually through the Outlook UI or when using the > > following code: > > > > m_oAppointmentItem.Resources = "Resource1;Resource2" > > m_oAppointmentItem.Recipients.ResolveAll 'succeeded with security alerts > > > > Additionally, when I am using MAPIUtils and creating > > SafeRecipient--"Resource1" is resolved. But it can't help me, and I wrote > it > > just to make sure that the problem is not Exchange related: > > > > Dim oSafeRecipient As SafeRecipient > > Dim oUtils As Object > > > > Set oUtils = CreateObject("Redemption.MAPIUtils") > > Set oSafeRecipient = oUtils.CreateRecipient("Resource1") > > If oSafeRecipient.Resolved = True Then > > Debug.Print oSafeRecipient.Name & "Resolved=True; Address=" & > > oSafeRecipient.Address > > End If > > > > Please advise. > > > > Regards, > > Michael Zino
|
|
|