Page 1 of 1

Contacts - File As - change default

Posted: Fri Oct 19, 2018 2:17 pm
by ivica.glavocic
Hi all

By default, when creating new contact, File As is set to "Last, First"
How can I change order to "First, Last" for all existing and new accounts?
COS maybe? Searched a lot, couldn't find an answer.

Thanks, regards
Ivica

Re: Contacts - File As - change default

Posted: Mon Oct 22, 2018 2:12 pm
by DualBoot
Hello,

as far as I know, it is by design.

Regards,

Re: Contacts - File As - change default

Posted: Wed Oct 24, 2018 8:52 am
by ivica.glavocic
We are migrating 200 users from Exchange to Zimbra, does it mean that we will have to change order for all 200 users manually, if possible at all?
Also every additional entry will have to be manually changed?
Very annoying limitation. Can't believe that this option is not covered, it is basic stuff.
Thanks, regards, Ivica

Re: Contacts - File As - change default

Posted: Wed Oct 24, 2018 2:46 pm
by JDunphy
I remembering have this exact same problem years ago. I went digging and found the script I used. Here is what I did for just a few users.

Code: Select all

#!/usr/bin/perl

#
# Step1: get list of contacts into a file
#        zmmailbox -z -m user@example.com gact > /tmp/user
# Step2: cat /tmp/user | argv[0]

# fileAs number
#(Blank) = Last, First
#1 = Last, First
#2 = First Last
#3 = Company
#4 = Last, First (Company)
#5 = First Last (Company)
#6 = Company (Last, First)
#7 = Company (First Last)
#8 = Custom - one must type: 8:<custom string>
#

#need email address
$emailAddr=shift(@ARGV);
if (!$emailAddr)
{
        printf "usage: %s: email address\n",$0;
}

sub FileAs {
 my($Id) = @_;

 #printf "zmmailbox -z -m user\@example.com mcta %s fileAs 1\n",$Id;
 printf "zmmailbox -z -m %s mcta %s fileAs 1\n",$emailAddr,$Id;
}

my $data = do { local $/; <STDIN> };
@data = split(/Id:/,$data);

foreach (@data)
{
        #default was 2
        if ($_ =~ /fileAs:\s*/)
        {

          # dont' touch group fileAs or existing ones that are file correctly
           if (($_ =~ m#type: group#) || ($_ =~ m#fileAs:\s*1#)) { next;}

            my ($Id) = $_ =~ m#\s+(\d+)#;
            if ($_ =~ m#/Contacts#)
            {
                FileAs($Id);
                #printf "[%s]\n",$_;
            }
        }
}
I drove the above script with this bash script.

Code: Select all

#!/bin/sh

#
# as zimbra user.
#
# To see what would change:
#     usage: /home/jad/Zimbra/scripts/zimbra-build-gact.sh
#
# To execute the changes:
#     usage: /home/jad/Zimbra/scripts/zimbra-build-gact.sh  | sh
#
pathname=/home/jad/Zimbra/scripts

# replace with this for list of all users... [domain] optional
# zmprov -l gaa [domain]
for i in user1 user2 user3 user4
do
	zmmailbox -z -m $i@example.com gact | $pathname/zimbra-contacts-fileAs.pl $i@example.com
done

exit 0
For 200 users, It would make more sense to just run the zmprov -l gaa after filtering out the spam/hash accounts. This might get you closer for your users.

HTH,

Jim

Re: Contacts - File As - change default

Posted: Thu May 20, 2021 1:12 pm
by kamesh
Were there any options added in console or CLI to sort this issue out?

Running 9.0.0_GA_3990 Network Edition.

If anyone finds it, let me know.

Thanks.