Hello Exchange developers,
I successfully added several custom categories into MasterCategoryList via Exchange Web Services API. I used a sample:
var list = MasterCategoryList.Bind(service); list.Categories.Add( new Category { Name = "Vacation", Color = CategoryColor.DarkMaroon, KeyboardShortcut = CategoryKeyboardShortcut.CtrlF10, Id = Guid.NewGuid()
});
But after some time I noticed my custom categories went away from MasterCategoryList for some reason. I found out despite I assigned "Guid.NewGuid()" to the "Id" property after some time MS Exchange nullify it ("0000-0000-..."). Does anybody solve such a problem? Thanks for your attention.
Thanks for your answer.
It seems I resolved this problem. It appeared contents of the "Id" property (Category class) should be wrapped inside curly brackets. In my case I used "Guid" type for "Id" property. Serializer applied "ToString" method and "Id" property looked like "e6de9b1b-a81c-46f6-81b3-c23edfab4478" but valid value is "{e6de9b1b-a81c-46f6-81b3-c23edfab4478}". So I changed type of "Id" property to "string". And valid version looks like:
var list = MasterCategoryList.Bind(service);
list.Categories.Add(
new Category {
Name = "Vacation",
Color = CategoryColor.DarkMaroon,
KeyboardShortcut = CategoryKeyboardShortcut.CtrlF10,
Id = "{" + Guid.NewGuid() + "}";
});
Please be aware.