I'm using the ews-javascript-api
to delete a contact from my exchange personal address book. I'm following the microsoft c# example (but obviously writing my code in javascript. Here's the example I'm following:
And here is my code to delete a contact.
const itemId = new ews.ItemId(id);
const contact = ews.Contact.Bind(window.exchangeService, itemId).then((response) => {
if (response) {
response.Delete(ews.DeleteMode.MoveToDeletedItems).then(response => {
dispatch( addressBookAction.deleteContactSuccess(response));
// Refresh our PAB
dispatch( addressBookAction.fetchAddressbook());
}).catch((error) => {
dispatch( addressBookAction.deleteContactFailure(error));
});;
}
});
Where id is a real id of a contact. I'm getting it by calling contact.Id.UniqueId
I'm getting an error when I try the ews.Contact.Bind
and passing it the ItemId object created from my contact id. It says the id is not formed correctly.
Ideas?
instead of creating new ItemId()
, use contact.Id
when using bind.