Following is the pice of code used to get the State field through CDO.
Program function is to find out each user's out of office text in the
organization and display the state in which the employee belongs. I was
sucessfully able to get the Out of office text message through CDO and
publish it but state information just returns blank after running for a day
or two (Program runs as a scheduled task in the windows explorer).
'***************************************************************
' Field to browse through all the fields collection in the Address entry
object
Set objField = Nothing
' This code gets the Address Entry
Set objAddressEntry = objAddressEntries.Item(1)
' Create a MAPI Session
Set objUserSess = Nothing
Set objUserSess = CreateObject("MAPI.Session")
' Profile to log on
strProfileInfo = strUserHomeServer & Chr(10) & objAddressEntry.Name
' Actual logon happens here
objUserSess.Logon "", "", False, True, 0, False, strProfileInfo
' Browse through the entire collection of fields in AddressEntry object of
CDO
For each objField in objAddressEntry.Fields
' Get the state field , which has Id of 974716958
If objField.Id = 974716958 then
strState = objField.value
exit for
End if
Next
'***************************************************************
Please let me know on what object would i use in the Outlook object model
Thanks
Chetan
Ken Slovak - said:
You could use the Outlook object model instead of CDO code. What is
your CDO code?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
Chetan Ashar said:
I have written a CDO script to get the list of employee's and which state
(in outlook address book) they belong, I access AddressEntry.Fields
collection to get the field object with Id of 974716958, which gives the
value of State field. Is there any other way i could get access to the state
field ???
Above mentioned method works fine but after its run in the task scheduler,
for some reason it does not get values for state, returns empty string.
Thanks in Advance.