I have to change InternetAddress based upon users intermediate OU (/SUB/) membership…but my agent doesn’t work. I test on a small local copy of the server’s names.nsf
REM “the above line because I went to suspect some issue with CR in FullName in the next line”
@Set(FN;@ReplaceSubstring(FullName;@NewLine;“”));
REM “the REM’d line above didn’t work”
REM “@If(@Like(FN;”%//SUB//%“;”/");@SetField(InternetAddress;Recipient+NewDomain);I surely forgot InternetAddress here, even if first test would have work. Maybe non SUB users would have had their InternetAddress reset to blank ); " ;
REM “neither work this one:” ;
REM {FIELD InternetAddress := @If(@Like(FN;“%//SUB//%” ; " /");Recipient+NewDomain;InternetAddress)}; <------nothing forgotten here ;-|… I hope!
REM “starting here I added selection criterion (which works fine when loaded in search module), but it still doesn’t work”
Subject: Can’t set InternetAddress with @formula agent
Fab,
here is the LS code I wrote. This is for hte PAB but can easily be modified for the nab.
Shawn
Sub setLocalNabMailAddress()
' Declare used variables
Dim session As New NotesSession
Dim pabDB As NotesDatabase
Dim pabDoc As NotesDocument
Dim pabColl As NotesDocumentCollection
Dim splitReturn As Variant
Dim userEmailAddress As String ' used to get existing address
Dim newEmailAddress As String ' used to set new address
Const domainName$ = "@yourdomain.org" ' new domain name
' set db options
Set pabDB = session.GetDatabase("", "names.nsf")
Set pabColl = pabDB.AllDocuments ' collect all documents in the address book DB
Set pabDoc = pabColl.GetFirstDocument ' grab the first doc from the address book
' loop through documents and put in new address - only looks for docs created with the "Location" form
While (Not(pabDoc Is Nothing))
' If (pabDoc.Form(0)="Location") And (pabDoc.Name(0) = "Office (Network)") Then ' make sure we are working with the Office profile document
If (pabDoc.Form(0) ="Location") Then ' make sure we are working with the Office profile document
userEmailAddress = Cstr(pabDoc.ImailAddress(0)) ' retrieve address from pab
If Not (userEmailAddress = "") Then ' Don't perform if field is blank
splitReturn = Split(userEmailAddress, "@") ' break up the users address
newEmailAddress = splitReturn(0) + domainName ' apend the new domain
Call pabDoc.ReplaceItemValue("ImailAddress", newEmailAddress) ' replace the address
Call pabDoc.Save( True, True ) ' save the record
End If
End If
Set pabDoc = pabColl.GetNextDocument(pabDoc) ' grab the next location
Wend
Subject: RE: Can’t set InternetAddress with @formula agent
Thank you Shawn.You know, I am not able to write a single line of LS… even can’t say I understand everything in your code. So I am not able to modify it to have it select a subset of users based on the part of their hierarchical name in upper case: cn/ou1/ou2/OU3/ou4/acme
Subject: RE: Can’t set InternetAddress with @formula agent
Hit me off list with your requirements. I will make the modifcations and re-post the new sub here if it’s not too much work.
Otherwise I can recommend some fee for services companies that you could use for future coding projects that utilize LS.
You also should fish around the code bin at www.openntf.org and the sandbox here. This may already exist or you might find other pieces you can sandwich with my code to do what you want.