Hi,
I use EWS library.
I have to create new appointment and send invitations to some attendees.
Than I need add or delete an attendee and send invitation to only changed attendee.
I found an
article on MSDN and tried to do it in test project:
public partial class Form1 : Form
{
private const string OFFICE_365 = "Office365_email@aa.com";
private const string GMAIL_1 = "Gmail1@gmail.com";
private const string GMAIL_2 = "Gmail2@gmail.com";
private ExchangeService _exchangeService;
private ItemId _itemId;
public ExchangeService ExchangeService
{
get
{
if (_exchangeService == null)
{
_exchangeService = new ExchangeService(ExchangeVersion.Exchange2013_SP1)
{
Credentials = new WebCredentials("sender@aa.com", "pass"),
Url = new Uri(@"https://outlook.office365.com/EWS/Exchange.asmx")
};
}
return _exchangeService;
}
}
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Appointment appointment = new Appointment(ExchangeService);
appointment.Start = DateTime.Now.AddDays(2);
appointment.End = appointment.Start.AddHours(2);
appointment.Subject = DateTime.Now.Ticks.ToString();
appointment.RequiredAttendees.Add(OFFICE_365);
appointment.RequiredAttendees.Add(GMAIL_1);
appointment.RequiredAttendees.Add(GMAIL_2);
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
_itemId = appointment.Id;
MessageBox.Show("Done");
}
private void button2_Click(object sender, EventArgs e)
{
Appointment appointment = Appointment.Bind(ExchangeService, _itemId);
appointment.RequiredAttendees.RemoveAt(0);
appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendOnlyToChanged);
MessageBox.Show("Done");
}
}
It doesn't work properly!! - When I update appointment (button2_Click) I receive invitation for all attendees! :(
I looked for the same provblem and found an
article on StackOverflow.
I tried to do it but it still doesn't work.
I use EWS 2.2 the last version: 15.0.913.15
How can I fix it?
Any ideas?
Thanks.