GAL reading and updation of data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
As per the documentation I found that the below are accessible (from the code
sample shown further below) -

MsgBox objAddressEntry.Manager (Manager's name returned)
MsgBox objAddressEntry.SMTPAddress (email address returned)

But if I need further details like Title,Company,Department etc I probably
have to go for the GetContact method and then access its properties. But I
could figure out how I could use it on the code below. Any suggestions would
be helpful!

-Safal
 
There is no AddressEntryFields collection in Redemption. Use
AddressEntry.Fields.

Redemption is different than CDO 1.21, which does have a Fields collection.
 
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
 
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
 
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)=Session.CurrentUser)Then
objAddressEntry.Fields(CdoPR_TITLE) = "Test"
objAddressEntry.Save
End If
Next
Does this have to do with access rights ?

-Safal
 
What is the *exact* error (both decsription and error code)?
Why do you need to loop through items in a list instead of just modifying
the RDOSession.CurrentUser object?

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

Error Number= -2147024891
Description=Error in IMAPIProp::SaveChanges: MAPI_E_NO_ACCESS
Source-Redemption.RDOAddressEntry

The loop through was just a sample. I might have to modify details for more
than 1 users in the GAL. Hence in the case below I was just experimenting
with my username to check if the Save works.

So this definately looks like an access issue. So if I want this to work I
should be running the same script from the "Administrator" logon - Is that
correct ?

-Safal
 
Hi,

Havent really managed to get rid of this permissioin issue. Does my NT logon
or Username have to be given some specific permission using Active Directory
? Can you please specify what needs to be done to gain permissions on the GAL
?

Also tried with an "Administrative" account but failed to work

-Safal
 
Back
Top