Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

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

    Scripting
    3
    4
    734
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Michael Niehren
      Michael Niehren last edited by

      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

      1 Reply Last reply Reply Quote 0
      • fbartels
        fbartels Kopano last edited by

        Which version are you using?

        Regards Felix

        Resources:
        https://kopano.com/blog/how-to-get-kopano/
        https://documentation.kopano.io/
        https://kb.kopano.io/

        Support overview:
        https://kopano.com/support/

        1 Reply Last reply Reply Quote 0
        • mark dufour
          mark dufour last edited by

          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…

          1 Reply Last reply Reply Quote 0
          • Michael Niehren
            Michael Niehren last edited by

            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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post