Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Amending location documents with a button 2

Status
Not open for further replies.

tonty

MIS
Jan 29, 2003
147
GB
We have 60 or so remote users who will soon be using a new email domain. Part of this process is obviously to edit each user's location document to alter their internet mail address. Is there a simple bit of script that I can put in a button for them to click that will do the job.

Please speak very slowly as my programming skills are virtually nil.

Regards,
Tony.
 
Hello Tony,

Try the following:

Select Script radio button for the formula type.
Paste the following code into the Declarations Event and make sure you change the XXX value with the name of your new Domain.

Sub Click(Source As Button)
Const NEWDOMAIN = "XXX"
Const ERRWARNING = "Please make a note of this message and contact your administrator"
Const ENDMESSAGE = "Thank you. The amendment to your mail configuration is complete"

Dim session As New NotesSession
Dim view As NotesView
Dim doc As NotesDocument
Dim itm As NotesItem
Dim db As New NotesDatabase("", "")

Call db.Open( "", "names.nsf" )

Set view = db.GetView( "Locations" )
Set doc = view.GetFirstDocument

While Not ( doc Is Nothing )
Set itm = doc.ReplaceItemValue ("XXX", NEWDOMAIN)
If Not doc.computeWithForm(true, true) then
msgbox "Location: " & doc.Name(0) & " - " & ERRWARNING
Else
Call doc.Save(True, True)
End If
Set doc = view.GetNextDocument( doc )
Wend
msgbox ENDMESSAGE
End Sub


If you have trouble getting this to work, I can create and send you the button.

Hope this helps.


Rgds,

John Judge
MCSE, MCSA, MCP, CCNA, CNA, Network +, A+
 
Thanks for the help, but somebody went round and did it manually before I had a chance to demonstrate my knew found expertise! [wink]

Regards,
Tony.
 
can see me the button in a email?

raymondseow@so-in-love.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top