Never fails, every time I post, I figure out my own solution after the
fact.
So, to remove an email address (or any other type of info from the you
need to need to iterate through the list of email addresses provided
using the following for style:
for (int i=0; i<entry.getEmailAddresses().size(); i++) {
Email email = entry.getEmailAddresses().get(i);
instead of
for (Email email : entry.getEmailAddresses()) {
that way when you happen upon the one you want to delete you can kill
it off with:
entry.getEmailAddresses().remove(i);
This same technique can be used to remove any of the other items
attached to your contact.
My problem was just finding the method of iteration which gave me some
kind of way to delete the list item and since I've never really worked
in Java before, it wasn't quite intuitive following the example on the
Contacts API site. Hopefully this post helps someone going through
the same self-learning problem.
- Ian
On Aug 18, 1:01 pm, Ian <[email protected]> wrote:
> This may or may not be a stupid question but I can't seem to find the
> answer anywhere and I'm running out of patience. I've never done much
> of anything with Java but since it seems to be the language that gets
> the most up to date treatment by Google for their APIs it's what I'm
> using. I'm developing a Java application to synchronize our company
> database with the Google Apps domain contact list and I just started
> by messing around with the example on the Contact API site pulling
> down the entire list and then I went along adding things, changing
> things without an issue.
>
> When I tried to remove an email address from a user however I couldn't
> see a method that was going to let me do that, I can easily change an
> email address but I can't figure out how to remove one. Tried setting
> it to blank but that just threw up errors.
>
> Any help would be appreciated.
>
> Thanks,
>
> - Ian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---