Ensuring Notes Connection Documents are Good

Sometimes it seems that what we Notes Admins typically have to worry about may seem to be out of our control. One such thing is the users’ local Address Books.

Management “We’re going to be moving the servers to the cloud, but it should be fine because only the IP address will be changing.”

Notes Admin “Yeah, you’re probably right. šŸ˜‰ šŸ˜‰ I doubt that any of our previous support people have ever used an IP address for a user’s Connection Document.” <frantically scrambles to see how to fix this without spending additional money>

If you’re a Notes Mail shop, this is a little simpler – you can utilize some type of mail-bomb technique which will just fix the connection documents. But if mail is elsewhere and you still have Notes Applications, you might do just as well to setup Notes Roaming (the “old-school” kind that is stored on the Domino Server and not on network shares…) and update what you need in the Roaming Address Books on the server.

The basic gist, as we’ll see below, is to get a handle on the roaming names.nsf databases and check the Connection documents. In my scenario, I’ve just created a view sorted by whether the user is roaming. Then on the selected person documents I can run the agent. You can also add a line into the agent to update the person document with a backend field so that you know the roaming Address Book has been processed.

I won’t bore you with all of the code, but here are a few snippets. I have attached the full agent. Also remember, if you ever needed to, you could also scan through location documents as well.

1 – You may want to log what you’re doing so that you have a record of each document that you’ve updated and what value you update. Something like below. The last line can be modified and added to various sections of the code to log what you’re doing.

Dim currentLog As New NotesLog( “Roaming Directories Update Log” )
Call currentLog.OpenNotesLog( “”, “ReplicationLog.nsf” )

Call currentLog.Logaction(“Scanning ” + CStr(seldoc.RoamSubdir(0) + “\” +seldoc.RoamAB(0)) + ” for ” + seldoc.FullName(0))

2 – Get a handle on the User’s names.nsf file. Basically just pull the values from the Domino Directory. Get the unprocessed documents and then step 3 below will iterate through them. You’ll have to dim and set other variables, but I did not include that in this code.

Set db = session.CurrentDatabase
Set dc = db.Unprocesseddocuments

Set seldoc = dc.Getfirstdocument()

3 – Update the Connection Document’s hostname/IP address.

While Not(seldoc Is Nothing)
Set seldb = session.getdatabase( seldoc.RoamSrvr(0), seldoc.RoamSubdir(0) + “\” +seldoc.RoamAB(0))
Set nabview = seldb.GetView(“Connections”)
Set nabdoc = nabview.GetFirstDocument

nabconnexists = “0” I’m setting this to 0 here and then you can get bonus points by adding code between the two wends below to create a connection document if this value is still set to 0 after not finding a connection to “CN=SERVERA/O=ABC” – I set the value to 1 if a connection is found.

While Not (nabdoc Is Nothing)
‘Update Priority of all documents to Normal – ahh yes, if you have IP address connections, you’ll probably have to do this for all of them even if that server’s IP isn’t changing! The worst thing is a Low priority connection document that just stops working and you can’t figure out why the user all of a sudden can’t connect to a server! šŸ™‚
If nabdoc.ConnectionRecordFirst(0) = “0” Then
Call nabdoc.replaceitemvalue (“ConnectionRecordFirst”,”1″)
Call nabdoc.save (True,True)
End If
If nabdoc.Destination(0) = “CN=SERVERA/O=ABC” Then
nabconnexists = “1”
If Not nabdoc.OptionalNetworkAddress(0) = “” Then
nabconnold = nabdoc.OptionalNetworkAddress(0)
Call nabdoc.replaceitemvalue (“OptionalNetworkAddress”,”″) – Yep, living on the edge by using an IP again! šŸ˜› Put a hostname here (and in line below)
Call nabdoc.replaceitemvalue (“PhoneNumber”,”″)
Call nabdoc.save (True,True)
End If
End If
Set nabdoc = nabview.getnextdocument(nabdoc)

And here is the full agent if you want to check it out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s