Add to AddressBook error?

Hi,
does anyone know why the home page part of my code below, simply does nothing (entry not added).

[code]Dim myBook As AddressBook = System.AddressBook
Dim myContact As AddressBookContact = New AddressBookContact

// DEFINE THE DETAILS TO INSERT
myContact.FirstName = “myFirstName”
myContact.LastName = “myLastName”
myContact.JobTitle = “myJobTitle”
myContact.EmailAddresses = “me@server.com

// SAVE TO THE USER’S ADDRESS BOOK
myBook.add myContact[/code]

Thanks you all in advance.

This should work:

Thanks Wolfgang - that worked perfectly :slight_smile:

Where in the Language Reference did you find that information?

I tried the same approach to add the homepage - but I received a runtime exception, saying unsupported label (use Work, Home, or Other) - even though I used Work?

Thanks.

I found this in the Examples (Platform-Specific -> OS X -> AddressBook)

To add the homepage address, I have the same problem as you. Only AddressBookData.LabelOther works without an error message, but there is no entry of the homepage. Maybe a bug?

Thanks Wolfgang,
Maybe a member of Xojo staff could comment?

Thanks.

Bumping this thread, so that hopefully a member of Xojo staff can confirm if this is a bug or not.

Thanks.

@Richard, Wolfgang: I have created a bug report for the missing image property <https://xojo.com/issue/39955> but your issues read like different cases. Do you have a small sample project for a feedback report?

Ulrich,
I don’t have the project file, but I simply put the code below in a button’s action event - and everything gets added except the homepage :frowning:

[code]Dim myBook As AddressBook = System.AddressBook
Dim myContact As AddressBookContact = New AddressBookContact

// DEFINE THE DETAILS TO INSERT
myContact.FirstName = “myFirstName”
myContact.LastName = “myLastName”
myContact.JobTitle = “myJobTitle”
myContact.EmailAddresses.Append(AddressBookData.LabelHome, “me@server.com”)
myContact.HomePage.Append(AddressBookData.LabelWork, “http://www.myserver.com”)

// SAVE TO THE USER’S ADDRESS BOOK
myBook.add myContact[/code]

Example using AppleScript to make new Contact

(change the Labels ‘Home’ or ‘Work’ in the scripts)

Thank you all! <https://xojo.com/issue/39959>

Axel,
Is your example MAS acceptable?

Thanks.

[quote=197634:@Richard Summers]Axel,
Is your example MAS acceptable?[/quote]

I dont know.

Nice workaround anyway :slight_smile:
Thanks.