Tagging User Email Addresses

In MicroStrategy 9.0, Web Subscriptions were moved from Narrowcast into the Intelligence Server in a new function called Distribution Services.  In the Narrowcast days, you had to maintain a separate metadata of user accounts and rely on a link between User and Email address.  Today, those are more tightly integrated, and the results is having Email addresses directly tied to User accounts as well as Contact lists.  One of the cool features this adds is the ability to subscribe other users, and let each manage their own subscriptions.  But that means the administrator has to setup and maintain the user’s default Email address, whereas in the past the user would add their own Email address list (or what has now become Contacts).  Today I’ll share a MicroStrategy Command Manager script that can help in keeping users tagged with their Email address.

The basic premise is that most of my projects have used Windows Authentication for security.  Since I import the users from Active Directory, their user names match their network accounts, which in turn match their email addresses.  If you are in a different environment, you may need to tweak the logic for how you identify what the Email address should be, or you may not be able to use this at all if you don’t have a way to tie it back.

Command Manager Procedure

  //get login name for each user in a group
 ResultSet oUsers = executeCapture(“LIST LOGIN FOR USERS IN GROUP “Everyone”;”);
 printOut(“There are ” + oUsers.getRowCount() + ” listed users”);
 while (!oUsers.isEof())
   String lLogin = (String) oUsers.getFieldValue(0);
   //add address to the user.
   execute(“ADD ADDRESS “” + lLogin + “” PHYSICALADDRESS “” + lLogin + “@yourcompany.com” DELIVERYTYPE EMAIL DEVICE “Microsoft Outlook” TO USER “” + lLogin + “”;”);

In the above script, I am collecting every user in the system by getting the contents of the Everyone group, and then using the Login name and assuming that’s the first part of their email address.  Next, I’m appending “@yourcompany.com” to complete the address, again assuming that all users are internal.  This wouldn’t work for external users, so you’d either need a different strategy for them or you’d need to exclude them from your initial group query by hopefully separating Internal and External users into different groups.

I’m also specifying the Device to use as opposed to taking the default Generic Email Device.  This is due to a few additional settings the Microsoft Outlook needs to display HTML properly, and I set those in the provided Microsoft Outlook Device rather than changing the settings for Generic Email Device in case that’s ever needed for another purpose some day.

It’s ok to run the script repeatedly, because any user who has been previously setup either manually or via this script will be skipped when trying to add an Email address that already exists.  In my environment, this is a quick and effortless way to make sure I haven’t missed any Email addresses when setting up users.  Or, when importing an entire department, it’s much faster than manually adding the Email address to each user I create.

You may also like...