python kopano, options --period-begin, --period-end does not work



  • Hi together,

    subject say’s it all. Take this simple script:

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    import kopano
    from MAPICore import *
    
    def opt_args():
        parser = kopano.parser('skpcubeC')
        return parser.parse_args()
    
    def main():
        options, args = opt_args()
        conn = kopano.Server(options=options)
    
        for user in conn.users():
          print ('search in user: [%s]' % user.name.encode("utf-8"))
          for folder in user.store.folders():
            count = 0
            for item in folder.items():
               count += 1
    
            print ('\tsearch in folder: [%s] --> %d items' % (folder.name.encode("utf-8"),count))
    
    if __name__ == '__main__':
        main()
    
    

    It should show the count of items in all folders of an user:

    mail@/data# ./kopano-period-bug.py -u michael                                                  
    search in user: [michael]
            search in folder: [Aufgaben] --> 0 items
            search in folder: [Entwürfe] --> 0 items
            search in folder: [Gelöschte Objekte] --> 0 items
            search in folder: [Gesendete Objekte] --> 0 items
            search in folder: [Journal] --> 0 items
            search in folder: [Kalender] --> 0 items
            search in folder: [Kontakte] --> 0 items
            search in folder: [Konversationseinstellungen] --> 0 items
            search in folder: [Notizen] --> 0 items
            search in folder: [Postausgang] --> 0 items
            search in folder: [Posteingang] --> 39 items
            search in folder: [RSS-Feeds] --> 0 items
            search in folder: [Schnellzugriffseinstellungen] --> 0 items
            search in folder: [Spam] --> 0 items
            search in folder: [Vorgeschlagene Kontakte] --> 0 items
    

    Now i only want to see the count of items which are 3 day’s old:

    mail@/data# ./kopano-period-bug.py -u michael --period-begin 2018-12-09 --period-end 2018-12-11
    search in user: [michael]
            search in folder: [Aufgaben] --> 0 items
            search in folder: [Entwürfe] --> 0 items
            search in folder: [Gelöschte Objekte] --> 0 items
            search in folder: [Gesendete Objekte] --> 0 items
            search in folder: [Journal] --> 0 items
            search in folder: [Kalender] --> 0 items
            search in folder: [Kontakte] --> 0 items
            search in folder: [Konversationseinstellungen] --> 0 items
            search in folder: [Notizen] --> 0 items
            search in folder: [Postausgang] --> 0 items
            search in folder: [Posteingang] --> 39 items
            search in folder: [RSS-Feeds] --> 0 items
            search in folder: [Schnellzugriffseinstellungen] --> 0 items
            search in folder: [Spam] --> 0 items
            search in folder: [Vorgeschlagene Kontakte] --> 0 items
    

    As you can see i got the same count of items. Every setting for period-begin or period-end brings the
    same count of items, so it seem’s not to work or is my call faulty ?

    best regards
    Michael


  • Kopano

    Which version are you using?



  • these options unfortunately aren’t applied automatically (at this moment). what you could do is something like:

    if options.period_begin < item.received < options.period_end:
    count += 1

    if we were to apply them automatically, we could make it a lot faster also…



  • Hi,

    sorry for the late reply, i’d forget to watch my own topic :-((.

    With your suggestion it work’s like a charme.

    Is it planed to apply them automatically ?
    In my used version V8.6.9 here it does not.

    best regards and many thanks for you help
    Michael


Log in to reply