How to remove color property from calendar item
-
Hello,
I used kopano-migration-pst to import an existing calender. Most of the items had the color property set. So in webapp these items are shown grey (category color ignored) with the categories “important”, “required”, “birthday”, … I want to remove this property with kopano-python. How can I achieve this? With other properties like Subject this is possible (with delete(prop)), but there is no constant defined for color prop like PR_SUBJECT_W for subjects.
Thanks,
Volker -
This is possible with
item.delete(item.prop(proptag="public:Keywords"))
-
Hello,
thanks for the reply. Unfortunately this does not work. It deletes only the categories (those I want to keep), the color prop (for old clients) stays the same.
Here’s an example:
I wouldn’t mind the extra categories, the problem is the category color (red, purple) doesn’t show in the calendar view - the items are displayed grey.
Volker
-
That’s saved in your WebApp settings.
You can use https://stash.kopano.io/projects/KSC/repos/webapp-tools/browse/webapp_admin to make a export and import the new versionpython3 webapp_admin.py --export-categories -u username
This wil create a json file
username-categories.json
and then change the color that matches the category name{ "additional": false, "color": "#DCB6E9", "name": "Birthday", "quickAccess": false, "sortIndex": 100000, "standardIndex": "", "used": "" },
Then import the new file
python3 webapp_admin.py --import-categories -u username
Use the
--file
parameter if you changed the json file name. -
Hello,
that also does not help, because the “important” category is not in the categories array but in the color prop:
print(item.categories)
shows:
['Uta']
and
print(item.color)
shows
red
So I need a way to remove the color prop. I have items were item.color is None, these are okay.
Thanks,
Volker -
I hope this is what you need otherwise i’m out of ideas
item.create_prop("PT_LONG:PSETID_Appointment:0x8214", 0x00000000)
or delete the propertyitem.delete(item.prop("PT_LONG:PSETID_Appointment:0x8214"))
If this works you can find the right numbers for the color here
https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidlidappointmentcolor-canonical-property -
Thanks,
that’s excactly what I needed. Now my calendar is colorful again.
Volker
-
Hi,
another question: If a calendar item has multiple categories, how is determined what color is used? Can you make “transparent” categories?
Thanks,
Volker -
Normally it should take the color of the last added category.
if you use the new categories you can define anything you like in the color value it will just copy over that value so this also works"color": "rgba(255, 0, 0, 0.5)",
, but a color needs to be set otherwise it will use gray as default color.