A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

GAL reading and updation of data



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 17th 07, 02:50 AM posted to microsoft.public.outlook.program_vba
Safal
external usenet poster
 
Posts: 28
Default GAL reading and updation of data

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
  #2  
Old August 17th 07, 05:26 AM posted to microsoft.public.outlook.program_vba
Safal
external usenet poster
 
Posts: 28
Default GAL reading and updation of data

Hey,

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

-Safal

"Safal" wrote:

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

  #3  
Old August 17th 07, 08:56 AM posted to microsoft.public.outlook.program_vba
Safal
external usenet poster
 
Posts: 28
Default GAL reading and updation of data

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

"Safal" wrote:

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

  #4  
Old August 17th 07, 02:58 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default GAL reading and updation of data

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

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

--
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


"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


  #5  
Old August 18th 07, 12:11 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default GAL reading and updation of data

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



  #6  
Old August 20th 07, 09:06 AM posted to microsoft.public.outlook.program_vba
Safal
external usenet poster
 
Posts: 28
Default GAL reading and updation of data

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




  #7  
Old August 20th 07, 08:26 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default GAL reading and updation of data

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






  #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






  #9  
Old August 21st 07, 07:10 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default GAL reading and updation of data

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

"Safal" wrote in message
...
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








  #10  
Old August 22nd 07, 07:06 AM posted to microsoft.public.outlook.program_vba
Safal
external usenet poster
 
Posts: 28
Default GAL reading and updation of data

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

"Dmitry Streblechenko" wrote:

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

"Safal" wrote in message
...
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









 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I migrate contacts data and email data to a new laptop ?? Ardvark Outlook - Installation 1 August 17th 07 04:31 PM
Updation of Reply/Forward icons on emails DK Outlook - General Queries 0 February 28th 07 02:44 AM
Outlook Offline Data Completely Different To Data When Connected Mike M Outlook - Installation 0 January 22nd 07 05:15 PM
How to copy data from Voting Button to MS Access Data NIMISH Outlook - General Queries 1 July 27th 06 01:12 AM
merge the data in one PC with the data from another PC Mark Outlook Express 1 May 30th 06 07:52 PM


All times are GMT +1. The time now is 08:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.