private voID createCalendarEvent(DateTime start,DateTime end,String dept,String subj,String subjType,String room) { AppointmentItem apt = (AppointmentItem)olapp.CreateItem(OlitemType.olAppointmentItem); apt.Start = start; apt.End = end; apt.Subject = subj + " - " + subjType; apt.Body = "Subject: " + subj + " (" + subjType + ")" + "\nDepartment: " + dept + "\nRoom: " + room + "\n\nCreated by " + this.Text + "\n On " + DateTime.Now.TolongDateString() + " At " + DateTime.Now.TolongTimeString(); apt.Location = room; apt.CategorIEs = subj; apt.Save(); }@H_403_7@这很好用,但我设置的类别没有与之关联的颜色.我希望outlook中的约会以不同的颜色显示,具体取决于类别集.有什么方法我可以手动设置类别颜色?或者甚至更好,一种让框架自动为我选择类别颜色的方法?解决方法 this question的答案涉及类别.具体来说,这里有一些代码(VB.net,但很容易转换),将创建一个深橄榄类: @H_403_7@ @H_403_7@
Private Shared Readonly category_TEST As String = "Custom Overdue Activity"' This method checks if our custom category exists,and creates it if it doesn't.Private Sub SetupCategorIEs() Dim categoryList As CategorIEs = Application.Session.CategorIEs For i As Integer = 1 To categoryList.Count Dim c As category = categoryList(i) If c.name.Equals(category_TEST) Then Return End If Next categoryList.Add(category_TEST,Outlook.olcategorycolor.olcategorycolorDarkOlive)End Sub@H_403_7@类别颜色可以在Outlook中设置,也可以在代码中创建类别时在上面的代码中设置. 总结
以上是内存溢出为你收集整理的c# – 如何着色Outlook AppointmentItem的类别全部内容,希望文章能够帮你解决c# – 如何着色Outlook AppointmentItem的类别所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)