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.