Results 1 to 8 of 8

Thread: set userfield 1 in public folder contacts

  1. #1
    Senior Member
    Join Date
    Jul 2008
    Location
    Hamburg / Germany
    Posts
    577

    set userfield 1 in public folder contacts

    Hi,

    i need to set the field "userfield 1", you can find in outlook contacts. (see pic attached)

    I got a csv file with the email adresses and the value that has to be written into this userfield 1.

    My Idea was to write a small perl script where I read the csv lines and run a sql update string direct on the mysql equal like this:

    " update table set table.userfield_1 = "value" where table.email = csv.email "

    Anybody has an idea where this "userfield 1" is stored in mysql?

    Or should I use the php mapi extension to access the data? But when I searched for this field in the example csv2contact.php, I cannot find it....

    regards
    mw
    Attached Images Attached Images

  2. #2
    Senior Member
    Join Date
    Nov 2007
    Location
    Belo Horizonte, Brazil
    Posts
    1,475

    Re: set userfield 1 in public folder contacts

    Hi mw,

    generally it is a bad idea to write into the database directly unless you really know what are you doing. You also have to be aware that some information is cached and it might not be available for the clients unless you restart the zarafa-server.

    Yes, that is the preferred way to save data in Zarafa. You could use developer tools like OutlookSpy or MFCMAPI to find out what property it is and set it using PHP MAPI (you'll probably have to save some value in this field first in order it appear in the field list).

    Greets, Manfred
    Please do not PM me asking for support. Use the forum instead. Thank you.
    I usually check the mobility thread at the end of the day, so please have some patience if there's no immediate response. Asking to look at certain thread per PM won't result in a faster answer.

  3. #3
    Senior Member
    Join Date
    Jul 2008
    Location
    Hamburg / Germany
    Posts
    577

    Re: set userfield 1 in public folder contacts

    Hi Manfred,

    first of all thanks for the hints. I manged to read my public contacts and to create my export csv files out of emailadress, userfield1 / 2 and 3.

    But I do not get the point how to change an existing contact and add the missing property.

    this is what I got in my php script until now:

    - Open csv file and read the lines which contains the email adress and the data which should be written into property userfield1 (0x80FF001E)
    - access my adressbook and read out of it

    Foreach line in the csv file I need to:

    - open the contact object where the email adress matches the email adress out of the csv line
    - update this object - set data to userfield1 (0x80FF001E)
    - save theses changes to the object.

    In my opinion this has to be done with the general functions:

    mapi_getprops(mapiobject $obj,
    array $properties);
    mapi_setprops(mapiobject $obj,
    array $properties);
    mapi_savechanges(mapiobj $object);

    I got stuck, any php dev can give me a hint how to get, set and save to the right object?

    regards
    mw

  4. #4
    Senior Member
    Join Date
    Nov 2007
    Location
    Belo Horizonte, Brazil
    Posts
    1,475

    Re: set userfield 1 in public folder contacts

    Hi mw,

    in order to open an object you need its entryid. There are examples in the forum how to get it. Finding the right contact might be done e.g. by using restriction.

    Greets, Manfred
    Please do not PM me asking for support. Use the forum instead. Thank you.
    I usually check the mobility thread at the end of the day, so please have some patience if there's no immediate response. Asking to look at certain thread per PM won't result in a faster answer.

  5. #5
    Senior Member
    Join Date
    Jul 2008
    Location
    Hamburg / Germany
    Posts
    577

    Re: set userfield 1 in public folder contacts

    Hi manfred,

    thanks for your help so far.

    Now I get this output:
    #####################################
    - Searching customer

    Warning: mapi_table_queryallrows(): Unknown property type 00000000 in /home/import.php on line 53

    Warning: mapi_table_queryallrows(): RES_PROPERTY or RES_CONTENT, Wrong data in field VALUE in /home/import.php on line 53

    Warning: mapi_table_queryallrows(): Failed to convert the PHP srestriction array in /home/import.php on line 53
    #####################################

    Line 53 ist the marked line .... And when I read all lines from this contact-folder "0x8133001E" is the emailadress of the user... and $field[0][email protected]
    any suggestions what I am doing wrong?

    regards
    mw

    ######################
    ###################

  6. #6
    Senior Member
    Join Date
    Nov 2007
    Location
    Belo Horizonte, Brazil
    Posts
    1,475

    Re: set userfield 1 in public folder contacts

    Hi mw,

    your restriction is wrong. It should be

    (assuming that you are using the right property for the email address, I haven't checked it).

    Please also use code tags for your code, it makes it easier to read.

    Greets, Manfred
    Please do not PM me asking for support. Use the forum instead. Thank you.
    I usually check the mobility thread at the end of the day, so please have some patience if there's no immediate response. Asking to look at certain thread per PM won't result in a faster answer.

  7. #7
    Senior Member
    Join Date
    Jul 2008
    Location
    Hamburg / Germany
    Posts
    577

    Re: set userfield 1 in public folder contacts

    Hi manfred,

    sorry for being such a nagger :/ I am not very familiar with this mapi stuff...

    With Restrictions I get strange output, not logical to me right now, so I fill an array with all I need and search for the emailadress in this array.
    This works quite well, I find the right contact and have its entryid.

    I cannot find anything how to open my object ($obj) with my PR_ENTRYID.

    After opening I set the Property and save the changes .... but how do I open it....

    I tried this:

    $obj=mapi_msgstore_openentry($publicstore, $rows[$i][268370178]);
    $props = Array(0x80FF001E => $field[1]);

    mapi_setprops($obj, array ($props));


    But getting this error:

    Warning: mapi_setprops(): Unknown property type 00000000 in /home/import.php on line 74

    Warning: mapi_setprops(): Unable to convert PHP property to MAPI in /home/import.php on line 74



    regards
    mw

  8. #8
    Senior Member
    Join Date
    Jul 2008
    Location
    Hamburg / Germany
    Posts
    577

    Re: set userfield 1 in public folder contacts

    DOOHH! ,

    I removed the "array" in "mapi_setprops($obj, array $props)" and it works! my contact is filled

    thnx for your help manfred! I move up to the next step.

    regards
    mwmail

Similar Threads

  1. Replies: 6
    Last Post: 01-07-2011, 08:44 AM
  2. Public Folder Contacts
    By LargeAssy in forum Outlook usage Archives
    Replies: 1
    Last Post: 23-11-2010, 09:32 PM
  3. exchange public contacts folder to zarafa
    By jtorrents in forum Migration Archives
    Replies: 4
    Last Post: 12-02-2010, 03:34 PM
  4. RC1 - webaccess + public folder contacts
    By billb3 in forum Beta Feedback Archives
    Replies: 1
    Last Post: 07-02-2008, 05:03 PM
  5. syncing mobile contacts with public folder contacts
    By tinus01 in forum Mobile devices Archives
    Replies: 2
    Last Post: 01-02-2008, 05:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •