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

    Set the contact webpage in python

    Scripting
    3
    12
    1596
    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.
    • T_x123
      T_x123 last edited by T_x123

      Hi,

      how to set the contact webpage. The tags PR_BUSINESS_HOME_PAGE / PR_BUSINESS_HOME_PAGE_W and PROP_TAG( PT_STRING8, 0x802B ) didn’t work.

      import kopano
      from MAPI.Tags import *
      
      server = kopano.Server(
      ...
      )
      
      user = server.user('user1')
      contacts = user.store.folder('Contacts')
      
      item = contacts.create_item(subject='', message_class='IPM.Contact')
      item.set_value(PR_DISPLAY_NAME_W,u'test1')
      item.set_value(PR_BUSINESS_TELEPHONE_NUMBER,"123")
      item.set_value(PR_BUSINESS_HOME_PAGE_W,u'www.test1.com')
      
      
      1 Reply Last reply Reply Quote 0
      • markb
        markb last edited by

        Hi,

        I see you are not importing the mapi tags, try to add this below import kopano.

        from MAPI.Tags import *
        

        Kind regards,

        Mark

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

          Sorry in my original script the import exists and there are no errors but the webpage are not set. I’ve added the import above.

          Kind regards

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

            Hi,

            This works for me.

            import kopano
            from MAPI.Tags import PR_DISPLAY_NAME_W, PR_BUSINESS_TELEPHONE_NUMBER, PR_BUSINESS_HOME_PAGE_W
            
            server = kopano.Server()
            
            user = server.user('kopano')
            contacts = user.store.folder('Contacts')
            
            item = contacts.create_item(message_class='IPM.Contact')
            item.create_prop(PR_DISPLAY_NAME_W, u'test1')
            item.create_prop(PR_BUSINESS_TELEPHONE_NUMBER, "123")
            item.create_prop(PR_BUSINESS_HOME_PAGE_W, u'www.test1.com')
            

            Kind regards,

            Mark

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

              The create_prop method does not work for me… Don’t no why. No errors but the fields are empty.

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

                Which version of kopano are you using ?

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

                  8.4.6.0-0+9

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

                    I am running 8.5.81.276-0+31.1 but I see no reason why my code should not work at your side.

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

                      Ok thank you for your answers, I will test it on a clean installation.

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

                        I just tested on my live server on 8.5.0 it does work as well.

                        Kind regards,

                        Mark

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

                          yeah, the create_prop method did not always save the message, and I guess we fixed this for 8.5.

                          for 8.6 we are working on not needing any MAPI-level stuff for dealing with contact fields, so you could say, for example:

                          item = contacts.create_item(
                          name=u’test1’,
                          business_homepage=’…’,
                          business_phone=’…’,
                          )

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

                            I’ve tested again with kopano 8.5.81.224-0 amd64 and webapp 3.4.6.1225+7 on a debian 9.3.
                            The create_prop method works but the PR_BUSINESS_HOME_PAGE_W only displayed on the outlook client.
                            An indication error within the webapp frontend client?

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