Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / August 2007

Tip: Looking for answers? Try searching our database.

GAL reading and updation of data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Safal - 17 Aug 2007 01:50 GMT
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
Safal - 17 Aug 2007 04:26 GMT
Hey,

Please let me know if any of you has any inputs ?

-Safal

> Hi,
>
[quoted text clipped - 32 lines]
> Regards,
> Safal
Safal - 17 Aug 2007 07:56 GMT
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

> > Hi,
> >
[quoted text clipped - 32 lines]
> > Regards,
> > Safal
Ken Slovak - [MVP - Outlook] - 17 Aug 2007 13:58 GMT
There is no AddressEntryFields collection in Redemption. Use
AddressEntry.Fields.

Redemption is different than CDO 1.21, which does have a Fields collection.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Hi,
>
[quoted text clipped - 35 lines]
> Regards,
> Safal
Dmitry Streblechenko - 17 Aug 2007 23:11 GMT
You can access any property exposed by GAL through RDOAddressEntry.Fields -
see http://www.dimastr.com/redemption/rdo/MAPIProp.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

> Hi,
>
[quoted text clipped - 35 lines]
> Regards,
> Safal
Safal - 20 Aug 2007 08:06 GMT
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

> You can access any property exposed by GAL through RDOAddressEntry.Fields -
> see http://www.dimastr.com/redemption/rdo/MAPIProp.htm#properties
[quoted text clipped - 45 lines]
> > Regards,
> > Safal
Dmitry Streblechenko - 20 Aug 2007 19:26 GMT
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

> Thanks veyr much Dmitry and Ken.
> Is it possible to update the GAL entries using redemption ? Or do we have
[quoted text clipped - 57 lines]
>> > Regards,
>> > Safal
Safal - 21 Aug 2007 04:56 GMT
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

> Of course, just set the the relevant properties using
> RDOAddressEntry.Fields() and call RDOAddressEntry.Save
[quoted text clipped - 65 lines]
> >> > Regards,
> >> > Safal
Dmitry Streblechenko - 21 Aug 2007 18:10 GMT
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

>I tried a simple example as below but come across the mentioned error -
> Redemption.RDOAddressEntry: Error calling IMAPIProp::SetProps
[quoted text clipped - 80 lines]
>> >> > Regards,
>> >> > Safal
Safal - 22 Aug 2007 06:06 GMT
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

> 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
[quoted text clipped - 89 lines]
> >> >> > Regards,
> >> >> > Safal
Dmitry Streblechenko - 22 Aug 2007 18:05 GMT
It sure sounds like a permission issue...

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

> Here are the details -
>
[quoted text clipped - 111 lines]
>> >> >> > Regards,
>> >> >> > Safal
Safal - 28 Aug 2007 08:34 GMT
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

> It sure sounds like a permission issue...
>
[quoted text clipped - 118 lines]
> >> >> >> > Regards,
> >> >> >> > Safal
Dmitry Streblechenko - 28 Aug 2007 19:46 GMT
See http://support.microsoft.com/kb/272198

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

> Hi,
>
[quoted text clipped - 142 lines]
>> >> >> >> > Regards,
>> >> >> >> > Safal
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.