This repository was archived by the owner on Jun 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 566
This repository was archived by the owner on Jun 18, 2024. It is now read-only.
Can't add contact to contact group #583
Copy link
Copy link
Open
Description
Hello,
I have a little test app, that creates two contact groups and one contact.
I'm able to add on contact group to the other but it does not work to add my contact to the contact group.
I get this exception:
Exception in thread "main" microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: Die Kontaktadresse wurde nicht gefunden.
at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
at microsoft.exchange.webservices.data.core.ExchangeService.internalUpdateItems(ExchangeService.java:691)
at microsoft.exchange.webservices.data.core.ExchangeService.updateItem(ExchangeService.java:762)
at microsoft.exchange.webservices.data.core.service.item.Item.internalUpdate(Item.java:279)
at microsoft.exchange.webservices.data.core.service.item.Item.update(Item.java:400)
at de.tresorband.ewstest.EWSTest.main(EWSTest.java:100)
"Die Kontaktadresse wurde nicht gefunden" means "concact address could not be found".
Here is my code. The exceptions comes from the last line.
Folder contacts=Folder.bind(service, WellKnownFolderName.Contacts);
ContactGroup cgroup = new ContactGroup(service);
cgroup.setBody(new MessageBody("contact groups "));
cgroup.setDisplayName("testxyz");
cgroup.save(contacts.getId());
ContactGroup cgroup1 = new ContactGroup(service);
cgroup1.setBody(new MessageBody("contact groups "));
cgroup1.setDisplayName("testabc");
cgroup1.save(contacts.getId());
Contact contact = new Contact(service);
contact.setGivenName("ContactName");
contact.setMiddleName ("mName");
contact.setSurname("sName");
contact.setSubject("Contact Details");
// Specify the company name.
contact.setCompanyName("technolgies");
PhysicalAddressEntry paEntry1 = new PhysicalAddressEntry();
paEntry1.setStreet("12345 Main Street");
paEntry1.setCity("Seattle");
paEntry1.setState("orissa");
paEntry1.setPostalCode("11111");
paEntry1.setCountryOrRegion("INDIA");
contact.getPhysicalAddresses().setPhysicalAddress(PhysicalAddressKey.Home, paEntry1);
contact.save();
System.out.println(contact.getId());
cgroup.getMembers().addContactGroup(cgroup1.getId());
cgroup.update(ConflictResolutionMode.AlwaysOverwrite);
cgroup.getMembers().addPersonalContact(contact.getId());
cgroup.update(ConflictResolutionMode.AlwaysOverwrite); // <--- exception
Metadata
Metadata
Assignees
Labels
No labels