View Single Post
  #8  
Old August 21st 07, 05:56 AM posted to microsoft.public.outlook.program_vba
Safal
external usenet poster
 
Posts: 28
Default GAL reading and updation of data

I tried a simple example as below but come across the mentioned error -
Redemption.RDOAddressEntry: Error calling IMAPIProp::SetProps

For Each objAddressEntry In objAddressEntries
If(objAddressEntry.Fields(CdoPR_DISPLAY_NAME)=Sess ion.CurrentUser)Then
objAddressEntry.Fields(CdoPR_TITLE) = "Test"
objAddressEntry.Save
End If
Next
Does this have to do with access rights ?

-Safal
"Dmitry Streblechenko" wrote:

Of course, just set the the relevant properties using
RDOAddressEntry.Fields() and call RDOAddressEntry.Save

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Safal" wrote in message
...
Thanks veyr much Dmitry and Ken.
Is it possible to update the GAL entries using redemption ? Or do we have
to
switch back to CDO ? Please let me know of any samples available online.

-Safal

"Dmitry Streblechenko" wrote:

You can access any property exposed by GAL through
RDOAddressEntry.Fields -
see http://www.dimastr.com/redemption/rd...htm#properties
You can see the exposed properties using OutlookSpy (click IAddrBook
button,
click "Open Root Container", go to the GetHierarchyTable tab, etc)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Safal" wrote in message
news Hi,

I am using the redemption object to connect to the GAL and read each
item
with its attributes like Name,Department,telephone etc.

Below is the script I tried -

objAddressEntry.Fields seems to be failing (does not find the
collection) -
Any particular reason ? Where as objAddressEntry.Name seems to work
fine
and
returns the name of the group or contact from the GAL.

Also how can I update the GAL ? (as a next step)

Const CdoPR_GIVEN_NAME = &H3A06001F
Const CdoPR_TITLE = &H3A17001E

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set AddrList = Session.AddressBook.AddressLists.Item("Global Address
List")
MsgBox "There are " & AddrList.AddressEntries.Count & " items in the
GAL"

Set objAddressEntries = AddrList.AddressEntries
int i=0

For Each objAddressEntry In objAddressEntries
on error resume next
Set objAddressFields = objAddressEntry.Fields
MsgBox objAddressEntry.Name
If Not objAddressFields is Nothing Then
MsgBox objAddressFields.Item(CdoPR_GIVEN_NAME).Value
MsgBox objAddressFields.Item(CdoPR_TITLE).Value
End If
Next

Regards,
Safal






Ads