简体   繁体   English

如何在C#中更改Outlook日历颜色?

[英]How to change Outlook Calendar Color in C#?

I'm writing some C# code to view/add/edit AppointmentItems in Microsoft Outlook 2007. I'm accessing a secondary calendar (MAPIFolder), and I would like to programmatically change the color of the calendar. 我正在编写一些C#代码来查看/添加/编辑Microsoft Outlook 2007中的AppointmentItems。我正在访问辅助日历(MAPIFolder),我想以编程方式更改日历的颜色。 Is that possible? 那可能吗?

myNamespace = outLookApp.GetNamespace("MAPI");
if (myNamespace.Categories["liveMeeting"] == null)
{
  myNamespace.Categories.Add("liveMeeting", OlCategoryColor.olCategoryColorDarkRed, OlCategoryShortcutKey.olCategoryShortcutKeyNone);
}
newEvent.Categories = "liveMeeting";

Appointments in Outlook are colored, not calendars. Outlook中的约会是彩色的,而不是日历。 Colors are set based on the Categories assigned to the appointment, so I think using AppointmentItem.Categories would allow you to set the color applied to the appointments you create. 颜色是根据分配给约会的类别设置的,因此我认为使用AppointmentItem.Categories可以设置应用于您创建的约会的颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM