| Code level: intermediate Code area: Outlook Expert Techniques Printer Friendly Version | ||
| Title: Get calendar color labels | ||
| Description: This VBA sample shows how to use CommandBars to get the complete list of 10 color labels from any calendar folder. | ||
| Date: 17-Feb-2005 01:36 | ||
| Code level: intermediate | ||
| Code area: Outlook Expert Techniques | ||
| Posted by: Sue Mosher | ||
| Body: |
||
| All 4comments |
| Page [ 1 ] | ||
|
|
Sue Mosher
17-Feb-2005 09:42
NOTES: 1) Both this function and the one at http://www.outlookcode.com/codedetail.aspx?id=755 return a semicolon-delimited string of the color labels for a given folder. The GetCalLabelsCB() function returns all the labels, while the GetCalendarLabels() returns only those labels that the user has customized. 2) A practical application of this technique is to get the default set of labels for the current user. This function creates a calendar folder under Deleted Items, returns its labels as a semicolon-delimited list, then deletes that folder: Function GetDefaultCalLabels() Dim objNS As Outlook.NameSpace Dim objCal As Outlook.MAPIFolder Dim objDeletedItems As Outlook.MAPIFolder Dim objMovedFolder As Outlook.MAPIFolder On Error Resume Next Set objNS = Application.GetNamespace("MAPI") Set objCal = objNS.GetDefaultFolder(olFolderCalendar) GetDefaultCalLabels = GetCalLabelsCB(objCal) Set objDeletedItems = objNS.GetDefaultFolder(olFolderDeletedItems) Set objCal = objDeletedItems.Folders.Add(FormatDateTime(Now, vbGeneralDate), _ olFolderCalendar) GetDefaultCalLabels = GetCalLabelsCB(objCal) objCal.Delete Set objCal2 = Nothing Set objCal = Nothing Set objNS = Nothing Set objMovedFolder = Nothing Set objDeletedItems = Nothing End Function |
|
|
|
Sue Mosher
17-Feb-2005 09:42
For more useful CommandBars applications, see http://www.outlookcode.com/d/tips/commandbarfun.htm |
|
|
|
Richard Kagerer
30-Apr-2006 12:31
In case anyone needs them, here are the RGB values for the label colors: 255, 148, 132 132, 156, 231 165, 222, 99 231, 231, 214 255, 181, 115 132, 239, 247 214, 206, 132 198, 165, 247 165, 206, 198 255, 231, 115 |
|
|
|
Sue Mosher
01-May-2006 14:01
Nice! Thanks, Richard. |
|
| Page [ 1 ] | ||
| Post your comment name email |
