CPAO: Using Colors for Categories and Private Items

 

It seems that one of the "holy grails" for the Calendar Printing Assistant is to be able to colorize entire appointments with the category colors for those appointments. There is a way to signify the category with CPAO - which is the colored dot that I have used / showed in previous posts. However - since Outlook actually makes the entire appointment the color of the assigned category - people want to see this in CPAO as well.

 

Well - after editing these templates for a couple years I did find a way that you CAN actually color entire appointments with the category color. However - this is a tedious task, it is difficult to manage, and it is limited in ability. So it can be done - but it may or may not be worth the effort and administrative upkeep.

 

Also - you can colorize Private Items - and that is a bit easier to do and does not require any upkeep - so I'll show that as well.

 

So here is a sample of a template I created to demonstrate this:

 

 

Yes - this is actually a template I created and it is really showing the color categories without the dots.

Also please note the private item at 5:00 on Monday - it is colored gray.

 

This template was modified starting with the Work Week 02 Letter template, and I added the necessary code to do the category and private item coloring. I also modified the timescale to include more of the day, and modified the header a bit - as that seems to help get the data in the appointments a little better since the timescale was increased.

 

So here is the code I added for the colorization:

 

...

...

                <TimeSlot Orientation="Fill" StartHour="7" EndHour="19"

                          MinorUnit="30" Style="SingleBody"

                          Background="Transparent">

                  <Appointment Style="SingleAppointment" Background="White">

 

                    <!-- Make the Background actually match the category... -->

                    <!-- The Category Name is used for this - and since it can

                             be changed in Outlook, it is only feasible if it is

                             NEVER changed -->

                    <!-- and ALL clients who print using CPAO must use the same

                             names for the same colors -->

                    <!-- AND - even with this, users should only ever use ONE

                             category per meeting/appt. as only one will work -->

                    <ConditionalFormat Condition="Categories eq 'Red Category'"

                                       Background="Red"/>

                    <ConditionalFormat Condition="Categories eq 'Blue Category'"

                                       Background="Blue"/>

                    <ConditionalFormat Condition="Categories eq 'Green

                                       Category'" Background="Green"/>

                    <ConditionalFormat Condition="Categories eq 'Orange

                                       Category'" Background="Orange"/>

                    <ConditionalFormat Condition="Categories eq 'Yellow

                                       Category'" Background="Yellow"/>

 

                    <!-- Make the appt GRAY if it's marked as PRIVATE...  -->

                    <!-- Had to put this below the Category section so that it

                             would work over a category -->

                    <ConditionalFormat Condition="Sensitivity eq 'Private'"

                                       Background="Gray"/>

 

                    <Bar Orientation="Left" Visibility="Collapsed" Width="5"

                         BorderThickness="0,0,1,0">

                      <ConditionalFormat Condition="BusyStatus eq 'Free'"

                                         Visibility="Visible"

                                         Style="SingleAppointmentBarFree"/>

                      <ConditionalFormat Condition="BusyStatus eq 'Tentative'"

                                         Visibility="Visible"

                                         Style="SingleAppointmentBarTentative"/>

                      <ConditionalFormat Condition="BusyStatus eq 'OutOfOffice'"

                                         Visibility="Visible"

                                         Style="SingleAppointmentBarOOF"/>

                    </Bar>

                    <Content Orientation="Fill" Margin="2,0,2,0" Separator="116"

                             FontSize="8pt" SeparatorFontFamily="Wingdings"

                             TextWrapping="WrapWithOverflow">

                      <ContentElement Source="OddTimes"/>

                      <ContentElement Source="Subject" FontWeight="Bold"/>

                      <ContentElement Source="Location"/>

                      <ContentElement Source="Organizer"/>

                     

                    </Content>

                  </Appointment>

                </TimeSlot>

...

...

 

So to go through this briefly - I set the background color of the appointments to "White" - which is something I have shown before. So all appointments will have a White background unless the category is different. This is where the conditional statements come in.

These conditional statements will test the Category Name - not the Category Color. If the Category Name matches the Category Name from Outlook, then it will color the background with the color that I choose.

Please note that users can change the Category Name in Outlook - so that is one of the big caveats of doing this. Also - I - as the person editing the template - must know that "X" Category Name matches up to "Y" Category Color. That is so I will put in the right info so that the right color will show for the particular appointment with the particular category name applied to it.

So as long as you can get a mapping of color to Outlook category name - then you can get this working. But the user can never change the name of the category. Or else if they do - then you will have to go back in and update the template accordingly. Same problem if a category is added - it would have to be added to the template and refreshed. Also - if a user assigns 2 or more categories, then this won't work and the appointment will go back to the default color - in this case White.

 

Now for the Private Items - the code is very similar. There is a test to see if the Sensitivity is set to Private. If so - then the background color is set to Gray. You could set it to any color you like. Since this is more static as far as the test - it is MUCH easier to implement and maintain.

 

So - yes, it can be done. Depending on the environment where it's deployed, it could work very well. But it could also break a whole lot in other environments.

 

I attached the Content.xml for this template so you can use or compare with a template you're working on...

 

Cheers!

Content.xml