LS Sample Code - Reformat username string or internet address function Function NotesNameReformat(origname As String, formatchoice As Integer) As String ' this function takes an incoming name, sets it to a new Notes Name object ' returns the desired format of the name using the following: ' 1 = canonical ' 2 = abbreviated ' 3 = common only ' ... (see select case for rest) Dim aName As NotesName ' name object On Error Goto FErrorHandler ' create object Set aName = New NotesName(origname) ' process return If (aName.IsHierarchical) Then ' process hierarchical options Select Case formatchoice Case 1 ' canonical NotesNameReformat = aName.Canonical Case 2 ' abbreviated NotesNameReformat = aName.Abbreviated Case 3 ' common NotesNameReformat = aName.Common Case 4 ' organization (O part) NotesNameReformat = aName.Organization Case 5 ' organization unit first level (OU1 part) NotesNameReformat = aName.OrgUnit1 Case 6 ' organization unit second level (OU2 part) NotesNameReformat = aName.OrgUnit2 Case 7 ' organization unit third level (OU3 part) NotesNameReformat = aName.OrgUnit3 Case 8 ' organization unit fourth level (OU4 part) NotesNameReformat = aName.OrgUnit4 Case Else ' return original NotesNameReformat = origname End Select Else ' process flat or internet format Select Case formatchoice Case 11 ' internet address (e.g. jdoe@mw.com) NotesNameReformat = aName.Addr821 Case 12 ' internet address phrase part (e.g. "Jane Doe" part of "Jane Doe" ) NotesNameReformat = aName.Addr822Phrase Case 13 ' internet address localpart (e.g. jdoe part of "Jane Doe" ) NotesNameReformat = aName.Addr822LocalPart Case 14 ' internet address first comment (e.g. My title comments part of "Jane Doe" (My title comments) ) NotesNameReformat = aName.Addr822Comment1 Case Else ' return original NotesNameReformat = origname End Select End If Exit Function FErrorHandler: ' return original input and cancel NotesNameReformat = origname Exit Function End Function