Difference between revisions of "Automating Reciprocal Calendar Sharing"

 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
The problem: you've just added a new department of users to your Zimbra server. All of those users need to share their calendars with each of the other members of their department (and you'd rather not explain how to do this manually to all of them ;-).  
+
{{Archive}}The problem: you've just added a new department of users to your Zimbra server. All of those users need to share their calendars with each of the other members of their department (and you'd rather not explain how to do this manually to all of them ;-).  
  
 
One solution:  
 
One solution:  
Line 42: Line 42:
  
 
Also, the initial script takes a while to run (~2 minutes for a 10-user distribution list, in one instance) due to the various lookups that are required. The generated script takes even longer to run.
 
Also, the initial script takes a while to run (~2 minutes for a 10-user distribution list, in one instance) due to the various lookups that are required. The generated script takes even longer to run.
 +
 +
 +
{{Article Footer|unknown|2/8/2010}}
 +
 +
[[Category:Administration]]
 +
[[Category:Calendar]]
 +
[[Category:Sharing]]

Latest revision as of 14:54, 24 March 2015

The problem: you've just added a new department of users to your Zimbra server. All of those users need to share their calendars with each of the other members of their department (and you'd rather not explain how to do this manually to all of them ;-).

One solution:

First, create a distribution list with all of the relevant user accounts via the Zimbra Admin console.

The following BASH script takes the name of that distribution list as a command line argument, then outputs a series of CLI commands to share each members's calendar (read-only) with the distribution list, then add a mountpoint to each user's shared calendar to the other list members' calendars. The script should be run as the zimbra user.

#!/bin/bash

if [ "$#" == "1" ]
then
users=$(zmsoap --type admin --zadmin GetDistributionListRequest/dl="$1" @by="name" | grep dlm | sed -e 's/.*<dlm>\(.*\)<\/dlm>/\1/g')

echo $users

for u in $users
do
    echo zmmailbox -z -m $u modifyFolderGrant /Calendar group psychstaff@psymail.ucdavis.edu r
    uname=$(zmmailbox -z -m $u gid -v | grep zimbraPrefFromDisplay | sed -e 's/.*: "\(.*\)",/\1/')
    for v in $users
    do
        if [ $u != $v ]
        then
            echo zmmailbox -z -m $v createMountpoint --view appointment \"/$uname\'s Calendar\" $u /Calendar
        fi
    done
done
else
    echo "usage: $0 distlist@zimbradomain.com"
fi

NOTE: This script will just print out a bunch of commands: it won't actually *run* them. You should redirect the output of this script to a text file, then sanity check the commands in the text file BEFORE you try to run them. For example:

[zimbra@mail ~]$ zimbraRecipCalShare.sh mylist@mydomain.com > check_me_first.sh
... then verify that the commands in the check_me_first.sh file are sane . . . 
[zimbra@mail ~]$ bash check_me_first.sh

Also, the initial script takes a while to run (~2 minutes for a 10-user distribution list, in one instance) due to the various lookups that are required. The generated script takes even longer to run.


Verified Against: unknown Date Created: 2/8/2010
Article ID: https://wiki.zimbra.com/index.php?title=Automating_Reciprocal_Calendar_Sharing Date Modified: 2015-03-24



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search