Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How do I use Lotus Script to edit the current location document?

Posted on 2005-05-10
4
Medium Priority
?
2,689 Views
Last Modified: 2013-12-18
My Notes client is 6.5.3 and our Domino server is also 6.5.3.

I need to use Lotus Script to edit the location document on our Notes clients.   Specifically, I need to change "Format for messages addressed to internet addresses:" on the Mail tab to "MIME Format."

I already have a button with this code behind it that edits the location document.  I just don't know the variable names needed to make function like I need it to.

Sub Click(Source As Button)
      On Error Goto handleError
      
      Dim session As New NotesSession
      Dim dbNames As NotesDatabase
      Dim collLocations As NotesDocumentCollection
      Dim docLocation As NotesDocument
      Dim strSearchString As String
      Dim dateCutoff As New NotesDateTime("12/01/94")
      
      strSearchString = |Form = "Location" |
      
      Set dbNames = New NotesDatabase( "", "names.nsf" )
      Set collLocations = dbNames.Search( strSearchString,dateCutoff , 0)
      Set docLocation = collLocations.GetFirstDocument
      While Not(docLocation Is Nothing)
            docLocation.mailserver = "mail1"
            docLocation.Domain = "scstudentloan"            
            doclocation.imailaddress = ""
            
            Call docLocation.Save(True, True)
            Set docLocation = collLocations.GetNextDocument(docLocation)
      Wend
      Messagebox "Updated the location documents success fully.", 0+64, "Updated:"
      Exit Sub
handleError:
      Messagebox "Error occured while modifying location documents." & Err() & ": " & Error(), 0+16, "Error: "
      
End Sub
0
Comment
Question by:pervisanathema
  • 2
4 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 13969290
Dim ldb As New NotesDatabase("", "names.nsf")
Set lview = ldb.GetView("Locations")
Set ldoc = lview.GetDocumentByKey("Office (Network)")
Set item = ldoc.ReplaceItemValue("MailServer", newservername)
Set item = ldoc.ReplaceItemValue("MailFile", newfilename)
Call ldoc.Save(False, False)

...possible modification to above code to lookup the users location document name first:

Dim ldb As New NotesDatabase("", "names.nsf")
Set lview = ldb.GetView("Locations")
locationStr=session.GetEnvironmentValue("Location", True)
posComma=InStr(",",locationStr)
locationStr=Left(locationStr,posComma)
Set ldoc = lview.GetDocumentByKey(locationStr)
Set item = ldoc.ReplaceItemValue("MailServer", newservername)
Set item = ldoc.ReplaceItemValue("MailFile", newfilename)
Call ldoc.Save(False, False)

the above is a sample code to change mail file location in location doc. u can use EditDocument in the code. Check help for EditDocument
0
 
LVL 19

Accepted Solution

by:
madheeswar earned 1200 total points
ID: 13969407
check this and let me know. Not tested.. looks similar code, u can change.
Dim ldb As New NotesDatabase("", "names.nsf")
Set lview = ldb.GetView("Locations")
locationStr=session.GetEnvironmentValue("Location", True)
posComma=InStr(",",locationStr)
locationStr=Left(locationStr,posComma)
Set ldoc = lview.GetDocumentByKey(locationStr)
if not ldoc is nothing then
set doc.MessageFormat="1"
call ldoc.save(False,False)
end if
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 13969442
If you were to update my address book, I'd be very cross with you afterwards if you had adapted ALL my locations like this. May I suggest to describe in your mail what the button you supply is doing, so that the advanced user (if you have any) can change the Location documents himself?
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 13975198
If you use 6.5.3, you don't need a script to do this, you can set this automatically by using Policies !
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Screencast - Getting to Know the Pipeline
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question