
 | 

Extracting user names from a recipient's list
Tip submitted by
Dhanasekar Dhandapani


Level: Intermediate
Works with: Notes/Domino
Updated: 04/01/2003

Related link:
More Tips from LDD | 
 | 
This tip describes a method for extracting user names from a recipients list that contains users in different domains. Using the Notes formula language, you can extract names from the SendTo, CopyTo, and BlindCopyTo fields. You can use the code described in this tip in the following areas:
- In a SmartIcon
- In a view selection or column formula
- In agents or view action buttons
In the following code example, we extract only user names belonging to the same company.
- Create a Smarticon, view selection or column formula, or an agent in your mail file database and add the following code to the programmer's pane:
Recipients:=SendTo : CopyTo : BlindCopyTo;
OriginalAbbrevList:=@Name([Abbreviate];Recipients);
OriginalCommonList:=@Name([CN];Recipients);
CommonAppendList:=OriginalCommonList +"/MyCompany/MyDomain@MyDomain";
UnwantedList:=@Replace(OriginalAbbrevList;CommonAppendList;"");
FilteredList:=@Replace(OriginalAbbrevList;UnwantedList;"");
- Replace /MyCompany/MyDomain@MyDomain with the appropriate company and domain names.
- Save and close the agent.
- The next time you receive an email with a recipients list with users from the same domain run the agent to gather the list of names.
In the first line, the variable Recipients gets the names from the SendTo, CopyTo, and BlindCopyTo fields. In line two, the recipients list is converted to its abbreviated format. In the code example, the company user names are abbreviated, and the rest are not. In line three, the recipients list is converted to its Common name format. In the code example, the company user names are converted to their common name format, and the rest are not. Line four is the most important because the abbreviated user name format is generated again, this time by appending OU and U. The OU and U are specific to our company, which in turn helps to extract our users. In line five, an unwanted list is obtained when the OriginalAbbrevList is replaced with empty spaces in the list from line four (that is, our company user names are replaced with empty spaces). Finally, line six repeats line five with the UnwantedList (containing users other than our company users), fetching the company users instead.
Note: If you use this tip with a SmartIcon, use @Prompt([OK];"Our Company Users";@Implode(FilteredList)) as the last line of the code. Then users can select a mail memo and click the SmartIcon to find out the company user names. But remember that @Prompt displays only 254 characters.
SUBMIT YOUR TIPS! |
We encourage you to send us your tips (You can also click the "Would you like to submit a tip?" graphic below.) Your tips can be anything you've discovered about any Lotus product. The most important thing is that your tip be interesting, useful, or handy. And be sure to include complete information about how your tip works. For ideas, take a look at our tip archives. If we publish your tip, we'll send you the IBM Redbooks Lotus Collection on CD. |
|
| 
 |