Search This Blog

Thursday, November 11, 2010

How to automate migration of distribution lists to google apps groups

One of the weak areas google apps has is the import of groups (aka distribution lists). There is no easy way to automate creation of groups in google apps.

Here are the steps to automate migration of groups (distribution lists) to google apps groups.

Step 1: Create a csv file of distribution list name and email ids in following format
name it: migrate.csv
distro1:emailid1, emailid2,emailid3
distro2:emailid4, emailid5,emailid6
distro3:emailid1, emailid3,emailid5

Step 2: Generate automation script file
use following awk script to generate automation script
create an awk script file , name it : gen.awk
copy following code into it.

# begining of the file

BEGIN {
    FS=":"
}
{ print "URL GOTO=https://www.google.com/a/cpanel/<domain name>/CreateGroup"
  print "TAG POS=1 TYPE=A ATTR=ID:createGroup"
  print "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:c ATTR=ID:gn CONTENT="$1
  print "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:c ATTR=ID:ge CONTENT="$1
  print "TAG POS=1 TYPE=TEXTAREA FORM=NAME:c ATTR=ID:gd CONTENT="$1
  print "TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:c ATTR=ID:group-preset-team-internet CONTENT=YES"
  print "TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:create ATTR=ID:createbtn"
  print "TAG POS=1 TYPE=TEXTAREA FORM=ACTION:Group ATTR=ID:add-members-textarea CONTENT="$2
  print "TAG POS=1 TYPE=SELECT FORM=ACTION:Group ATTR=ID:addMembersRole CONTENT=%MEMBER"
  print "TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:addmember ATTR=ID:add-members-add-button" }


# end of the file

run following command on a unix prompt
awk -f gen.awk migrate.csv

Step 3: Install iMacros for Firefox
https://addons.mozilla.org/en-US/firefox/addon/3863/

Step 4: Run iMacro
 
rename an existing macro or create a new one using record and save action in "rec" tab
click Edit macro (right click on macro name) , paste the text generated in step 2, close & save
click on Play (in play tab) to run the automated script to generate groups.

that's it !! you are done.

3 comments:

  1. To replace ^M characters in a file with new line use following command in vi editor.

    %s/[control-v followed by control-m]/\r/g

    ReplyDelete
  2. This is a smart blog. I mean it. You have an excellent knowledge about this topic. Thanks for sharing such a great blogs to us. oracle fusion SCM training india

    ReplyDelete