/ Forums / Advansys Formativ / Creating Solutions with Formativ / custom fields in address book / Reply To: custom fields in address book
Hi,
maybe this helps. i received this code myself and i did not try out so far.
Yes. Here is some sample code that lists the values associated with a user defined field in an address book of your choice.
You will need to edit the value of the constants USER_DEFINED_FIELD to be the name of your field, and ADDRESS_BOOK_NAME to be the name of the address book you wish to access.
I hope this helps.
Advansys Support
‘——————————————————————————-
‘ This sample applet will display address book entries with user defined field
‘ value.
‘——————————————————————————-
‘ User defined field name
const USER_DEFINED_FIELD = “uid”
‘ Address book name
const ADDRESS_BOOK_NAME = “Test Book”
‘——————————————————————————-
‘ Main line processing
‘——————————————————————————-
Sub Main(Client, GWEvent)
dim iEntry
dim iList
dim iValue
dim iFieldsObj
dim iAddressBooksObj
On Error Resume Next
Set iAddressBooksObj = GroupWise.AddressBooks
set iAddressBookObj = iAddressBooksObj.item(ADDRESS_BOOK_NAME)
if not iAddressBookObj is nothing then
set iList = utilities.stringlist
iList.add(“Display Name, User defined field value”)
for each iEntry in iAddressBookObj
set iFieldsObj = iEntry.object.Fields
set iFieldObj = iFieldsObj.item(USER_DEFINED_FIELD, fgwString)
if isobject(iFieldObj) then
iValue = iFieldObj.value
end if
set iFieldObj = nothing
set iFieldsObj = nothing
iList.add(iEntry.displayname & “, ” & iValue)
next
msgbox iList.Text
set iList = nothing
end if
set iAddressBookObj = nothing
set iAddressBooksObj = nothing
End Sub