Outlook - Add Color Coding to Calendar Items
By Sergey - Posted on January 1st, 2008
Tagged:
The Outlook model doesn't provide access to the Label property, but it can be retrieved/changed via CDO 1.21.
Requires Outlook 2002 or later. Tested with Outlook 2003 only.
Based on http://www.outlookcode.com/codedetail.aspx?id=139
| This is sample code. Add error handling and adjust to your requirements as necessary. |
&& FUNCTION SetApptColorLabel && toAppointment - Appointment object to change label/color for && tnColor - Label/Color to assign LPARAMETERS toAppointment, tnColor LOCAL ccCdoPropSetID1, ccCdoAppt_Colors, loCDO, loMsg, loFields, loColorField, oExp AS Exception ccCdoPropSetID1 = "0220060000000000C000000000000046" ccCdoAppt_Colors = "0x8214" ccVbLong = 3 ASSERT BETWEEN(tnColor, 0, 9) MESSAGE "Color can be between 0 and 9" lcCurrFolder = FULLPATH("") loCDO = CREATEOBJECT("MAPI.Session") loCDO.Logon("", "", .F., .F.) SET DEFAULT TO (lcCurrFolder) loMsg = loCdo.GetMessage(toAppointment.EntryID, toAppointment.Parent.StoreID) loFields = loMsg.Fields TRY loColorField = loFields.Item(ccCdoAppt_Colors, ccCdoPropSetID1) CATCH TO oExp WHEN oExp.ErrorNo = 1429 AND ("MAPI_E_NOT_FOUND" $ oExp.Message) loColorField = loFields.Add(ccCdoAppt_Colors, ccVbLong, tnColor, ccCdoPropSetID1) ENDTRY loColorField.Value = tnColor loMsg.Update(.T., .T.) loCDO.Logoff() RETURN
Recent comments
11 hours 1 min ago
1 week 22 hours ago
4 weeks 14 hours ago
5 weeks 5 hours ago
5 weeks 5 hours ago
7 weeks 4 days ago
8 weeks 1 day ago
8 weeks 1 day ago
8 weeks 4 days ago
8 weeks 4 days ago