Lotusscript button to change email address on location doc

I am trying to create a button to email out to my users that will chnage their email address in all their location docs from user@OldDomain.com to user @NewDomain.com

Not being very familiar with lotusscript I found some code and adapted it but it just doesn’t make the change - though it is running as it comes up with the final message box. Please can anyone help me to see what is wrong? Many thanks Anne

THis is the code

Sub Click(Source As Button)

Dim s As New NotesSession

Dim view As NotesView

Dim doc As NotesDocument

Dim newDomain As String

Dim oldDomain As String

Dim toNotify As String



toNotify = "anne"

newDomain = "@olddomain.com"

oldDomain = "@newdomainx.com"

sNamesLine=s.GetEnvironmentString("NAMES", True) 

nPos = Instr(sNamesLine, ",") 

sNamesLine = "names.nsf"





Set db = New NotesDatabase( "",sNamesLine )



If Not(db.isOpen) Then

	Messagebox "Attention: Address book not found. Please, contact the Help Desk."

	Exit Sub

End If





Set view = db.GetView("Locations")





Dim email, domain, predomain As String

Dim message As String

message = ""

Set doc = view.GetFirstDocument

While Not doc Is Nothing

	If doc.HasItem("ImailAddress") Then

		email=doc.ImailAddress(0)

		domain = Strtoken(email, "@", 2)

		If domain = oldDomain Then

			predomain = Strtoken(email, "@", 1)

			email = predomain + newDomain

			message = message + " Location updated: " + doc.Name(0) + Chr(10)

			

			Call doc.ReplaceItemValue("ImailAddress", email) 

			Call doc.Save(True, False)

			

		End If

		

	End If

	Set doc = view.GetNextDocument(doc)

Wend





Messagebox "System updated. Thank you for your collaboration."

End Sub

Subject: dynamic client config

there is a process that runs on the client called Dynamic Client Configuration that should check/fix this field automatically when the user authenticates with their home mail server. There should be no need to update the location doc with a button, just update the person doc in the DD and it should do it on it’s own. The only way it won’t update is if somehow the location doc was set to not accept updates, but that should be rare.

http://webcache.googleusercontent.com/search?q=cache:d1p1X39a-PsJ:www.ibm.com/support/docview.wss%3Frs%3D899%26uid%3Dswg21212699+dynamic+client+configuration&cd=1&hl=en&ct=clnk&gl=us

Subject: Thanks for that

…have never used DCC before but thats really useful - and better than relying on users clicking a button - as there are always sone who just don’t!