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

    [Solved] Ex-/Import of a public Adressbook

    Kopano Groupware Core
    8
    18
    3343
    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.
    • MyKey0815
      MyKey0815 last edited by

      The Contacts2Csv working only with Contacts of a user - not with public folders. I try it with the user “system”, but i don´t have access to the public folder Adressbook

      I try it with “Public Folders\Intern” and “Public Folders\Adressbuch Intern” and “Public Folders” - but every time came up the “NotFoundError”

      1 Reply Last reply Reply Quote 0
      • robing
        robing Kopano (Inactive) last edited by

        Hi @MyKey0815 ,

        Please try the new version of https://stash.kopano.io/projects/KSC/repos/core-tools/browse/contacts2csv.
        We added an option to export from the public store.

        Regards Robin

        Regards Robin,

        Need support?
        Have a look at https://kopano.com/support/ for options.

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

        1 Reply Last reply Reply Quote 1
        • MyKey0815
          MyKey0815 last edited by

          Thanks for you addition. I have try it but they dont work.

          The show only follwing Error:

          root@SE69J4H32ZA2:~# python export2.py --public --folder "Intern" --export --delimiter ";"
          running script for 'Public store'
          Traceback (most recent call last):
            File "export2.py", line 237, in <module>
              main()
            File "export2.py", line 110, in main
              contacts = store.folder(options.folder)
            File "/usr/lib/python2.7/dist-packages/kopano/store.py", line 301, in folder
              return self.subtree.folder(path, recurse=recurse, create=create)
            File "/usr/lib/python2.7/dist-packages/kopano/folder.py", line 376, in folder
              raise NotFoundError("no such folder: '%s'" % path)
          kopano.errors.NotFoundError: no such folder: 'Intern'
          

          In Outlook the Folder is shown as “Adressbuch Intern”

          1 Reply Last reply Reply Quote 0
          • robing
            robing Kopano (Inactive) last edited by

            but then you should run

            python export2.py --public --folder "Adressbuch Intern" --export --delimiter ";"```

            Regards Robin,

            Need support?
            Have a look at https://kopano.com/support/ for options.

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

            1 Reply Last reply Reply Quote 0
            • MyKey0815
              MyKey0815 last edited by

              YES!!! Now the export is working fine

              1 Reply Last reply Reply Quote 0
              • dimamr
                dimamr last edited by

                Hello,
                I have subfolders. Unfortunately these are not synchronized. Can you do something there?

                1 Reply Last reply Reply Quote 0
                • robing
                  robing Kopano (Inactive) last edited by

                  @dimamr

                  You need to add the root folder, so if you subfolder in under the default contacts folder then you need to do

                  python contact2csv.py --user username --folder "Contacts/subfolder" --export 
                  

                  Regards Robin,

                  Need support?
                  Have a look at https://kopano.com/support/ for options.

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

                  segro 1 Reply Last reply Reply Quote 0
                  • segro
                    segro @robing last edited by

                    @robing
                    Hi robin,

                    when i try to run the script I get 2 Errors:

                    [root@server kopano-python]# python contact2csv.py --public --folder "All_Adressen" --export
                    Traceback (most recent call last):
                      File "contact2csv.py", line 243, in <module>
                        main()
                      File "contact2csv.py", line 109, in main
                        print('running script for \'{}\'').format(user)
                    ValueError: zero length field name in format
                    
                    

                    what is wrong here?
                    and, what should I do with the two date values?
                    PR_WEDDING_ANNIVERSARY and PR_BIRTHDAY need to be converted to Epoch timestamp.
                    how do I convert them?

                    1 Reply Last reply Reply Quote 0
                    • Illuvatar
                      Illuvatar last edited by

                      Hi,
                      is it possible to export categories? When i run the script, everything works well, but the .csv file doesn’t show any categories/labels.

                      Jonas

                      1 Reply Last reply Reply Quote 0
                      • markb
                        markb last edited by

                        @segro are you running python 2.6 perhaps ?

                        1 Reply Last reply Reply Quote 0
                        • segro
                          segro last edited by

                          it sounds like I should an other version? kopano is on Centos6 / webapp on Centos7 with php56
                          [root@mail ~]# python -V
                          Python 2.6.6
                          [root@mail ~]# ssh webapp
                          [root@webapp ~]# python -V
                          Python 2.7.5
                          [root@webapp ~]#

                          1 Reply Last reply Reply Quote 0
                          • markb
                            markb last edited by

                            The script is using a .format syntax which is only supported on python 2.7 or higher.
                            You could fix it yourself though
                            Replace {} with {0} in the line should do the trick.

                            1 Reply Last reply Reply Quote 0
                            • segro
                              segro last edited by

                              it seems to be a little difficult on centos6.
                              first I installed python 2.7 from redhat

                              yum --enablerepo=centos-sclo-rh -y install python27
                              ...
                              [root@mail kopano]# python2.7 contacts2csv.py --user username --export
                              Traceback (most recent call last):
                                File "contacts2csv.py", line 13, in <module>
                                  import zarafa as kopano
                              ImportError: No module named zarafa
                              

                              also I tried python33 from that repo, but :

                              please install python3-kopano
                              

                              but there is no python3-kopano package for Centos-6 :-(

                              Replacing all {} with {0} finaly works, but I have to comment out the two lines with Wedding and birthda (how to solve this?)

                              export is working with that, but import is still with error:

                               python contacts2csv.py --public --folder TEST --import test_contacts.csv
                              running script for 'Public store'
                              Traceback (most recent call last):
                                File "contacts2csv.py", line 308, in <module>
                                  main()
                                File "contacts2csv.py", line 237, in main
                                  new_item.mapiobj.SetProps([SPropValue(getattr(MAPI.Util,headers[num]), value)])
                                File "/usr/lib/python2.6/site-packages/MAPICore.py", line 289, in SetProps
                                  def SetProps(self, *args): return _MAPICore.IMAPIProp_SetProps(self, *args)
                              UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in position 10: ordinal not in range(128)
                              [root@mail kopano]#```
                              
                              thanks,
                              Sebastian
                              markb 1 Reply Last reply Reply Quote 0
                              • markb
                                markb @segro last edited by

                                @segro

                                It seems you have a unicode issue there is a ß somewhere in your csv, I am not sure if value.encode(‘utf-8’) will fix your issue you could give it a try.

                                1 Reply Last reply Reply Quote 0
                                • segro
                                  segro last edited by segro

                                  thank you for the quick response, … where should I put the value.encode in the script?
                                  line 237
                                  new_item.mapiobj.SetProps([SPropValue(getattr(MAPI.Util,headers[num]), value.encode(‘utf-8’))])
                                  but did not fix:

                                    File "contacts2csv.py", line 237, in main
                                      new_item.mapiobj.SetProps([SPropValue(getattr(MAPI.Util,headers[num]), value.encode('utf-8'))])
                                  AttributeError: 'int' object has no attribute 'encode'
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • smguenther
                                    smguenther last edited by

                                    Just in case someone stumbles across this old thread:

                                    Adding

                                    reload(sys)
                                    sys.setdefaultencoding('utf-8')
                                    

                                    right after the

                                    import(sys)
                                    

                                    solved the problem for me.

                                    Regards,

                                    Stefan

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