Results 1 to 7 of 7

Thread: Setting File as: attribute for contacts -- mass import

  1. #1
    Join Date
    Aug 2006
    Posts
    19
    Rep Power
    9

    Default Setting File as: attribute for contacts -- mass import

    I am still trying to import 1,800 contacts for one of my users.

    His address book has many, many records without a name; only a company field.

    Is there a way on import or via SOAP or Rest to set the File As: attribute of these addresses to be "Company", rather than "Last, First"? It would sure help tidy up his addressbook.

    TIA.

  2. #2
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    Default Change the "fileAs" value

    You'll want to set the "fileAs" attribute on the relevant contacts to 3 ("Company"). Don't change the other contacts!

    The easiest way to do that is via SOAP. Here's some sample SOAP that should be roughly correct; make sure to test before production!

    Code:
    <soap:Body>
      <ModifyContactRequest xmlns="urn:zimbraMail" replace="0" force="1">
        <cn id="{id-of-contact}">
          <a n="fileAs">3</a>
        </cn>
      </ModifyContactRequest>
    </soap:Body>
    Bugzilla - Wiki - Downloads - Before posting... Search!

  3. #3
    Join Date
    Aug 2006
    Posts
    19
    Rep Power
    9

    Default hm...

    Thanks -- I can use that.

    But (feeling stupid) where is the documentation for the fileAs Attribute and company = 3? I checked the docs and the SVN tree stuff documenting SOAP before I wrote the email. Did I just miss it? Or is your documentation of the SOAP API missing some details still?

    TIA.

  4. #4
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    Default May not be documented there...

    You may have to look at the server source files in Subversion to find the relevant info, I'm afraid.

    For the record, here are the 8 supported numerical values for the "fileAs" field:
    Code:
       52     /** "File as" setting: &nbsp;<code>Last, First</code> */
       53     private static final int FA_LAST_C_FIRST = 1;
       54     /** "File as" setting: &nbsp;<code>First Last</code> */
       55     private static final int FA_FIRST_LAST = 2;
       56     /** "File as" setting: &nbsp;<code>Company</code> */
       57     private static final int FA_COMPANY = 3;
       58     /** "File as" setting: &nbsp;<code>Last, First (Company)</code> */
       59     private static final int FA_LAST_C_FIRST_COMPANY = 4;
       60     /** "File as" setting: &nbsp;<code>First Last (Company)</code> */
       61     private static final int FA_FIRST_LAST_COMPANY = 5;
       62     /** "File as" setting: &nbsp;<code>Company (Last, First)</code> */
       63     private static final int FA_COMPANY_LAST_C_FIRST = 6;
       64     /** "File as" setting: &nbsp;<code>Company (First Last)</code> */
       65     private static final int FA_COMPANY_FIRST_LAST = 7;
       66     /** "File as" setting: <i>[explicitly specified "file as" string]</i> */
       67     private static final int FA_EXPLICIT = 8;
    So to switch a contact to "First Last (Company)", just set its "fileAs" value to 5 and the server will recalculate the rest.


    (Note that the web client may not support value FA_EXPLICIT yet; this type of "fileAs" is not completely numeric but instead looks like "8:foo bar baz".)
    Bugzilla - Wiki - Downloads - Before posting... Search!

  5. #5
    Join Date
    Aug 2006
    Posts
    19
    Rep Power
    9

    Default Okay -- how do I craft SOAP SearchRequest

    Think I can do this, if I can figure out how to write a SearchRequest for attribute lastName is missing --

    How do I write the query element of SearchRequest? I want something like this:

    Code:
    <soap:Body>
      <SearchRequest xmlns="urn:zimbraMail">
        <query>
          not attr="lastName" 
       </query>
      </SearchRequest>
    </soap:Body>

  6. #6
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    Default Don't think that's possible yet

    I don't think you can do a SearchRequest on individual contact fields yet, but you can do a GetContactsRequest and fetch only the "lastName" field. That should work, right?
    Bugzilla - Wiki - Downloads - Before posting... Search!

  7. #7
    Join Date
    Aug 2006
    Posts
    19
    Rep Power
    9

    Default Hm --

    So I suppose I get id and last_name for all contacts
    and then based on that output, fix the DisplayGroup attribute only for the contacts who have no last_name field?

    Okay -- will give that a try...

Similar Threads

  1. centos 5 zimbra 4.5.6 no statistics
    By rutman286 in forum Installation
    Replies: 9
    Last Post: 08-14-2007, 10:30 AM
  2. Opensource backup Question.
    By nfear24 in forum Administrators
    Replies: 3
    Last Post: 04-01-2007, 12:47 AM
  3. Replies: 5
    Last Post: 03-01-2007, 03:20 AM
  4. Traslation SVN tree status
    By meikka in forum I18N/L10N - Translations
    Replies: 7
    Last Post: 02-13-2007, 11:13 AM
  5. M3 problem with shares
    By titangears in forum Users
    Replies: 4
    Last Post: 01-12-2006, 01:01 PM

Posting Permissions

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