Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Group notification
jsw971
Has anyone out there come up with a relatively painless way of notifying a group of users that a group task has been assigned to their group? I know that the three configurable solutions workflows can do this, but I'm afraid it's beyond my reverse engineering capabilities to try to figure out what exact ingredients are needed to make this happen on Win 2000.
Thanks.
Find more posts tagged with
Comments
Adam Stoller
Essentially you need to take the groupid(s), expand them into a list of userids, and then lookup each userid in the mapping file (if used) and/or slap the
@$maildomain
(if '@' not already present) onto the names and then use this collection of email addresses as a list which you can then pass the reference of to the %headers 'to' element. - simple -no? :-)
For Windows, I believe the win32API::Net module provides the means of expanding a groupid entry into a list of userid entries. If a group can have nested groups, then you may need to go through this process multiple times until you've expanded all group entries into user entries.
You might want to throw this (either now, or later, or both) through a simple hash process to eliminate duplicate entries:
foreach my $e (
@full_list)
{ $hash{$e} = 1; }
my
@list_without_duplicates
= sort(keys(%hash));
Then, if you're using the email_mapping config (or someting similar), you'll want to run each userid through that to see if you can find a specified mapping for the userid to turn it into one or more email addresses - anything you cannot find in the mapping file you can either treat it as a warning, error, or [like iwsend_mail.ipl] a default case where you take the maildomain setting from iw.cfg and slap '
@$maildomain
' to the end of the userid to turn it into something that at least looks like it might be a valid email address.
Once you have all the email addresses in a list (
@list)
- you need to provide that list as a reference to the Mail::Mailer headers hash:
my %headers;
$headers{to} = \
@list
;
...
And then you send the email using the code already existing within scripts like iwsend_mail.ipl.
Hope that helps
--fish
(Interwoven Senior Technical Consultant)
jsw971
Thank you very much for the reply. I had looked into the Perl APIs and somehow had gotten the impression that you needed to be on a PDC to use those libraries. In terms of a painless solution, I came up with the following perl script:
use Win32API::Net;
Win32API::Net::LocalGroupGetMembers('',
@ARGV[0]
,\
@users)
; # get group members, first cmd argument
my $addresses =""; #initialize recipient list
for $user (
@users)
{
$addresses="$addresses,DOMAIN\\$user"; #append DOMAINNAME\user
}
$addresses =~ /^,(.*)$/; #remove initial comma
$addresses = $1; #ditto
$cmdline = "-t $addresses
@ARGV[1]
@ARGV[2]
@ARGV[3]"
; #command line args using -t recp1,recp2 and passing thru other args
exec ("c:\\iw-home\\iw-perl\\bin\\iwperl c:\\iw-home\\bin\\iwsend_mail.ipl $cmdline"); #run iwsend_mail.ipl
exit (0);
Works like a charm.
Thanks again.. Just needed someone to point me in the right direction.