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

    How to create Contacts folder in Python

    Scripting
    1
    1
    389
    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.
    • fr0nk
      fr0nk last edited by

      Hi,

      I’m trying to import contacts but I’m unable to create a sub-folder of type contacts. I can create a folder just fine like this:

      store = kopano.user(username).store
      contacts = store.contacts
      contacts.create_folder(new_foldername)
      

      But it is created without a PR_CONTAINER_CLASS_W Property, so Webapp displays it as a mail folder. I tried various ways to set that property, but it all fails.
      For example, this was my most promising idea:

      folder = contacts.get_folder(new_foldername)
      folder.prop(PR_CONTAINER_CLASS_W, True, "IPF.Contact")
      

      But this raises the following error:

      Traceback (most recent call last):
        File "kopano-create-folder.py", line 31, in <module>
          folder.prop(PR_CONTAINER_CLASS_W, True, "IPF.Contact")
        File "/usr/lib/python2.7/dist-packages/kopano/properties.py", line 42, in prop
          proptype=proptype)
        File "/usr/lib/python2.7/dist-packages/kopano/property_.py", line 204, in prop
          return create_prop(self, mapiobj, proptag, value=value, proptype=proptype)
        File "/usr/lib/python2.7/dist-packages/kopano/property_.py", line 169, in create_prop
          elif proptype2 & MV_FLAG:
      TypeError: unsupported operand type(s) for &: 'str' and 'int'
      

      How can i create a contacts folder or change an existing folder to contain contacts?

      Thanks for you help.
      Frank

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