Delete users wastebins - kopano-cleanup



  • Hi!

    I just migrated from Zarafa to Kopano. I have been using a script, that deletes old mails from the users wastebin for years (php-script), but the script is broken, now:

    PHP Warning:  mapi_logon_zarafa(): Unable to setup service for provider in...
    PHP Warning:  mapi_getmsgstorestable() expects parameter 1 to be resource, boolean given in
    PHP Warning:  mapi_table_queryallrows() expects parameter 1 to be resource, boolean given in 
    PHP Notice:  Undefined variable: storeEntryId in
    

    Now, I found a script called kopano-cleanup in the KB:
    https://kb.kopano.io/display/WIKI/Kopano+cleanup
    https://stash.kopano.io/projects/KSC/repos/core-tools/raw/kopano-cleanup.py?at=b043910401296709c99658388ce3101ac0dec676

    The script works for some of my users, but mos users show:

    Running script for 'XA'
    Traceback (most recent call last):
      File "/root/kopano-scripts/kopano-cleanup.py", line 98, in <module>
        main()
      File "/root/kopano-scripts/kopano-cleanup.py", line 85, in main
        print 'Deleted %s item(s) for user \'%s\' in folder \'%s\'' % (count, user.name, folder.name)
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 57: ordinal not in range(128)
    

    Can you give me a hint on how to get this script running?

    I am using Kopano-Core Product version: 8,4,0,1103

    Thank you for your help!

    Stril



  • Hi!

    I just found the problem:
    Most of my users are using “german” folder names. “Gelöschte Objekte” seems to break the line:
    print ‘Deleted %s item(s) for user ‘%s’ in folder ‘%s’’ % (count, user.name, folder.name)

    If I just remove the “folder-info”, the scripts can run:

    print ‘Deleted %s item(s) for user ‘%s’ in folder Wastebin’ % (count, user.name)

    Stril