Microsoft 365 Calendar multiplying

REPRODUCIBILITY: 100%
OS VERSION: 4.5.0.21 and before
HARDWARE: Xperia 10 iii, before on ii
UI LANGUAGE: EN
REGRESSION:

DESCRIPTION:

PRECONDITIONS:

Create account Microsoft 365, sync Calendar.

STEPS TO REPRODUCE:

  1. I don’t know what triggers the multiplying

EXPECTED RESULT:

1 Calendar (or set of)

ACTUAL RESULT:

More and more calendars appear.

MODIFICATIONS:

Android, but nothing special.

ADDITIONAL INFORMATION:

See screenshots


4 Likes

Are you deleting Office 365 accounts? If you do (e.g because they stop working as they reguarly do) then the calendars for that account don’t get deleted. If you then setup the account again, you get another new set of calendars and so on.

This thread here How Do You Delete Calendars and Address Books? explains how you can delete the calendar database manually. Note that this deletes ALL your calendars, so you must be able to resynchronize or restore from backup to get the ones you actually want back.

2 Likes

None of the above, actually. Create account once, and use it. The screenshot with 7 copies is the result of two years of usage.

The one with 2 copies is from one (!) week of usage.
Interesting thing: one of the Windpark calendars contains a recurring item, the other contains at least one new Teams meeting. Which I found out after wandering: I did create that meeting on my pc, or did I forget?

2 Likes

… Aaaaand… Number 3 arrived!

I just checked, and number 4 has appeared. This multiplying is happening even faster than on my X10ii!

1 Like

I have the same issue : 8 copies of the same calendar account but only one seems synchronized. It’s unusable.
Need for an urgent fix !

1 Like

Same here, on Xperia X (Duplicate xchange calendars, hundreds of entries over the years).

It’s not a new thing. I used to copy the sqlite calendar file and edit it by hand to get rid of extra entries. I don’t bother anymore (calendar are duplicated, but entries are not).

I pull/push from a Zimbra server. Switching to Caldav does not allow me to remotely create new entries on this server.

Note: I’ve not reflashed the phone yet, just kept upgrading SailfishOs. It may be an old error now fixed but keeping alive by broken configuration. I’ll post here if re-install helps.

Can anyone use Xchange without calendar duplication ?

Could it be that every time you create a new appointment in SailfishOS, that a new calendar is created?

Edit: no, a quick test does not show a new calendar.

Same issue, happening with every default and manually added calendar of personal outlook and company office365 account. For some reason only default calendar of my personal account is the only one unaffected, maybe there is something specific about it?
Any way to temporarily fix it?

In an attempt to delete the duplicate calendars by removing and readding the Exchange account, I am now stuck with a bunch of duplicate calendars that I can’t remove via the GUI it seems. I have 3 calendars that are duplicated 38 times each now.

1 Like

As a workaround, I did the following (requires development mode and the sqlite3 package):

I never worked on the calendar software, so I hope this does not mess things up seriously. Follow these steps at your own risk and make a backup!

  1. Remove and readd your exchange account

  2. Open a terminal on your phone (or better, SSH into it, because it is easier done on a computer) and run sqlite3 to edit the calendar database as root:

     $ devel-su sqlite3 ~/.local/share/system/privileged/Calendar/mkcal/db
    
  3. You are now in a sqlite3 shell. Let’s backup the database first, so you can roll back if you mess up

    sqlite> .backup calendar.db.bak
    
  4. Change the output mode to something more human readable

    sqlite> .mode table
    
  5. Find the id of the old account from the Calendars table. The following query will find accounts that have multiple calendars with the same name:

    sqlite> SELECT Name, account, pluginName, COUNT(*) as cal_count FROM Calendars GROUP BY Name, account, pluginName HAVING cal_count > 1;
    
    +-------------------------+---------+---------------------+-----------+
    |          Name           | account |     pluginName      | cal_count |
    +-------------------------+---------+---------------------+-----------+
    | Agenda                  | 16      | EasInvitationPlugin | 37        |
    | Feestdagen in Nederland | 16      | EasInvitationPlugin | 37        |
    | Verjaardagen            | 16      | EasInvitationPlugin | 37        |
    +-------------------------+---------+---------------------+-----------+
    

    In my case, the id is 16.

  6. Danger zone: at this point, make sure you have made a backup!
    Delete the offending calendars:

    -- Replace <account_id> with the id you got from the previous step, in my case 16
    sqlite> DELETE FROM Calendars WHERE account = <account_id>;
    sqlite> DELETE FROM Calendarproperties WHERE CalendarId NOT IN (SELECT CalendarId FROM Calendars);
    
  7. Show events without calendars and make sure they can be deleted:

    sqlite> SELECT Summary, datetime(DateStart, 'unixepoch') as DateStart FROM Components WHERE Notebook NOT IN (SELECT CalendarId FROM Calendars) ORDER BY DateStart;
    -- Output redacted due to privacy reasons :)
    

    If all is okay, actually delete them and remaining records related to these events:

    sqlite> DELETE FROM Components WHERE Notebook NOT IN (SELECT CalendarId FROM Calendars);
    sqlite> DELETE FROM Attachments WHERE ComponentId NOT IN (SELECT ComponentID FROM Components);
    sqlite> DELETE FROM Attendee WHERE ComponentId NOT IN (SELECT ComponentID FROM Components);
    sqlite> DELETE FROM Alarm WHERE ComponentId NOT IN (SELECT ComponentID FROM Components);
    sqlite> DELETE FROM Customproperties WHERE ComponentId NOT IN (SELECT ComponentID FROM Components);
    sqlite> DELETE FROM Rdates WHERE ComponentId NOT IN (SELECT ComponentID FROM Components);
    sqlite> DELETE FROM Recursive WHERE ComponentId NOT IN (SELECT ComponentID FROM Components);
    

This worked for me for now.

If at any point you messed up, you can run the following command in the sqlite3 shell with the calendar db open (see step 2):

sqlite> .restore calendar.db.bak
3 Likes

@thigg is this bug report of good quality in order to be added in the bug report for the next meeting please?

I actually considered this one for the last meeting, but usually I prefer bugs where its clear how to reproduce an issue.

As I read this thread, some people have this issue sometimes with office365 and dont know what triggers it, thus there is certainly some research required before a fix can be developed.

I will reconsider this bug for suggestion at a community meeting when it is reproducible.
My idea of what the community bug coordination team is doing is that we are trying to find the low hanging fruits in the bug reports and raise awareness.

You can always bring this bug yourself to a community meeting.

1 Like

Actually, as @pherjung pointed out somewhere else, this bug is already tracked as you can see from the tracked label of this topic.

Very annoying in the sense that this issue has been around for quite awhile however my memories of the circumstances have faded quite effectively. So no good clues, only some possible crumbs.

If I remember correctly I used to have similar issue with Android phone in around 2018. I had to use an app to delete the multiplied Outlook365 calendars from the phone. I have vague recollection that especially with subscribed calendars there was an issue in the sense that if I got rid of them on the phone and in Outlook (webUI) there could still be some remnants synced to the phone from the server. Never managed to find a solution for that before the Android phone broke but this made me think that this might be some stupid server stuff rather than a client thing.

Anyways, I started using X2 in March 2019 (then switched to 10 III in the summer 2022) and I now have 17 copies of the same calendars. This does somewhat align with O365:s 90 days reauthorization period as I used iPhone for a bit and there was that Oauth issue. This is to say only if the reauthorization does happen every 90 days with the Sailfish’s account connection as well…can’t even remember that accurately, but at least every now and then one needs to reauthorize the account in Sailfish nevertheless. Maybe a factor?

However I digged into the calendar database and there are some interesting dates related to one of my calendar and its copies:

syncDate          		modifiedDate     		createdDate
2023-07-13 02:08:51		2023-07-13 02:08:52		2023-01-31 23:57:29
1970-01-01 00:00:00		2023-07-16 14:35:21		2023-07-16 14:35:12
2023-07-20 00:45:36		2023-07-20 00:45:37		2023-07-16 19:51:28
2023-08-04 17:35:16		2023-08-04 17:35:17		2023-07-24 08:25:53
2023-08-17 05:57:37		2023-08-17 05:57:37		2023-08-13 21:36:22
2023-10-24 17:01:47		2023-10-24 17:01:50		2023-08-24 16:51:22
2023-12-03 08:39:27		2023-12-03 08:39:28		2023-11-11 13:02:59
2023-12-14 10:49:01		2023-12-14 10:49:06		2023-12-14 10:48:38
2023-12-22 01:08:27		2023-12-22 01:08:28		2023-12-19 06:31:06
2024-01-07 13:25:13		2024-01-07 13:25:13		2024-01-07 12:25:47
1970-01-01 00:00:00		2024-01-11 00:34:18		2024-01-11 00:34:09
1970-01-01 00:00:00		2024-01-18 13:17:38		2024-01-18 13:17:30
1970-01-01 00:00:00		2024-01-18 13:34:04		2024-01-18 13:33:54
2024-04-01 22:40:17		2024-04-01 22:40:18		2024-01-27 08:56:54
2024-04-05 13:52:36		2024-04-05 13:52:37		2024-04-02 05:08:08
2024-04-13 00:47:25		2024-04-13 00:47:25		2024-04-06 22:38:21
2024-04-30 13:16:09		2024-04-30 13:16:09		2024-04-13 07:52:07
(this last one has the latest/current calendar entries)

These creation dates are of course nonsense in the sense afaik the multiplication issue did not start in 2023-07-16 14:35:12. And if the dates are taken as a fact, they do not of course fit with the 90 day reauthorization cycle. However I’m 99% confident that I had to 17 copies of the same calendar about a month ago as I do now despite what the createdDate tells.

In comparison to these dates another calendar, a subscribed one, had pretty much the same creation dates with an possible offset of 1 or 2 seconds, otherwise didn’t see any other coinciding things.

I’ll try to monitor to see if there’s any interesting changes happening.

Edited for clarity