Accessing Address Book with Redemption OM
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ExchangeServerHelp.com
Accessing Address Book with Redemption OM

 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
AB
Guest





Posted: Wed Dec 14, 2005 9:58 am    Post subject: Accessing Address Book with Redemption OM Reply with quote

I am trying to access the address book and store the relevant details
on a custom form by looping through each selected recipient, which will
then be used with an event sink to send out emails to the chosen
recipients. I want to be able to do this without getting any Outlook
security warnings. I have been able to use the Redemption Object Model
in regards to storing the current users details, but cannot work out
how to go about changing the code below. Code below is from the custom
form.

Any help would be greatly appreciated.

Thanks in advance,
AB

'Open Address Book
'-----------------
Set objCDOSession = Application.CreateObject("MAPI.Session")
objCDOSession.Logon "", "", False, False, 0

set objRecipients = objCDOSession.AddressBook (Nothing, "Outlook",
False, True, 1, "Add", "", "", 0)

'Fill Custom fields with names and email addresses
'-----------------------------------
For each objRecipient in objRecipients

'Get SMTP address
strEMailAddress =
objRecipient.AddressEntry.Fields(CdoPR_EMAIL).Value

'Store Names and SMTP addresses in hidden fields, as well as "To"
field
if Trim(Item.UserProperties("To").value) = "" then
Item.UserProperties("To").value = objRecipient.Name
Item.UserProperties("Approver" & lngApproverNo).value =
objRecipient.Name
Item.UserProperties("Approver" & lngApproverNo & "Email").value =
strEMailAddress

'rest of code not required

Back to top
Ken Slovak - [MVP - Outlo
Guest





Posted: Wed Dec 14, 2005 5:58 pm    Post subject: Re: Accessing Address Book with Redemption OM Reply with quote

Dim safUtils As Redemption.MAPIUtils
Dim safRecips As Redemption.Recipients
Dim safRecip As Redemption.Recipient

Set safUtils = CreateObject("Redemption.MAPIUtils")
safUtils.MAPIOBJECT = objOutlook.Session.MAPIOBJECT

Set safRecips = safUtils.AddressBook(, "Outlook", False, True, 1, "Add", "",
"")

For Each safRecip In safRecips

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"AB" <yogibell@optusnet.com.au> wrote in message
news:1134537053.486160.138630@z14g2000cwz.googlegroups.com...
Quote:
I am trying to access the address book and store the relevant details
on a custom form by looping through each selected recipient, which will
then be used with an event sink to send out emails to the chosen
recipients. I want to be able to do this without getting any Outlook
security warnings. I have been able to use the Redemption Object Model
in regards to storing the current users details, but cannot work out
how to go about changing the code below. Code below is from the custom
form.

Any help would be greatly appreciated.

Thanks in advance,
AB

'Open Address Book
'-----------------
Set objCDOSession = Application.CreateObject("MAPI.Session")
objCDOSession.Logon "", "", False, False, 0

set objRecipients = objCDOSession.AddressBook (Nothing, "Outlook",
False, True, 1, "Add", "", "", 0)

'Fill Custom fields with names and email addresses
'-----------------------------------
For each objRecipient in objRecipients

'Get SMTP address
strEMailAddress =
objRecipient.AddressEntry.Fields(CdoPR_EMAIL).Value

'Store Names and SMTP addresses in hidden fields, as well as "To"
field
if Trim(Item.UserProperties("To").value) = "" then
Item.UserProperties("To").value = objRecipient.Name
Item.UserProperties("Approver" & lngApproverNo).value =
objRecipient.Name
Item.UserProperties("Approver" & lngApproverNo & "Email").value =
strEMailAddress

'rest of code not required
Back to top
AB
Guest





Posted: Thu Dec 15, 2005 1:59 am    Post subject: Re: Accessing Address Book with Redemption OM Reply with quote

Thanks for the "translation" Ken . All works well. Got another issue
now which I'll post under a different title, but I'll leave a little
teaser here as well.
I have a custom form which gets the current users details via the code
below. This form gets posted to a public folder which then in turn
sends an email (via an event sink) to the selected recipients (see code
above from initial posting). When I open the form, logged in on a
different PC (virtual PC set up with OL2003 on XPSP2) as a recipient I
get the following message:
microsoft vbscript runtime error: activeX component can't create
object: 'redemption.safeCurrentuser'
and the debugger opens up at the set CurrentUser =
CreateObject("Redemption.SafeCurrentUser") line.
Any suggestions ?
Cheers,
AB

Function Item_Open()
' - WITH REDEMPTION
set CurrentUser = CreateObject("Redemption.SafeCurrentUser")
strCurrentUser = CurrentUser.Name
strCurrentUserEmail = CurrentUser.Fields(&H39FE001E)
CurrentUser.cleanup
set CurrentUser = Nothing

Back to top
AB
Guest





Posted: Thu Dec 15, 2005 1:59 am    Post subject: Re: Accessing Address Book with Redemption OM Reply with quote

Please disregard the above. I figured out what was wrong. The Virtual
PC did not have Outlook redemption installed. Guess I should get the
redistibutable version.
Back to top
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server Dedicated Servers
New Topics Powered by phpBB