using (OutlookSession outlookSession = new OutlookSession())
{
if (outlookSession.Contacts.Items.AllowEdit)
{
ContactCollection CC = outlookSession.Contacts.Items;
Contact contact = CC[0];
contact.FirstName = "Freesc";
contact.Update();
}
else
{
MessageBox.Show("Not allowed to change it!!");
}
}
if (outlookSession.Contacts.Items.AllowEdit)
{
ContactCollection CC = outlookSession.Contacts.Items;
Contact contact = CC[0];
contact.MiddleName = "耕";
contact.Nickname = "永";
contact.LastName = "你好";
contact.Email1Address = "hugengyong@sina.com";
contact.FirstName = "Freesc";
contact.Update();
for (int i = 0; i < 20;i++ )
{
Contact con = new Contact();
con.FirstName = "胡";
con.MiddleName = "耕";
con.LastName = "永";
con.Email1Address = "hugengyong@sina.com";
CC.Add(con);
}
}
else
{
MessageBox.Show("Not allowed to change it!!");
}