Notes directory for a Blackberry RIM device

Ever noticed how management wants the strangest things?

You Can View User Feedback To This Tip

Ever noticed how management wants the strangest things? My company has Blackberry Enterprise Services running on one of our Domino servers. We have some executives with their own Blackberry units who receive email via this device. We also have 3 loaner units we program and send out with executives when they travel. I was charged with porting our Domino directory into the Blackberry loaner units. Well several ideas came to mind on how to do this...but there were some complications:
1) we have more than one address book (Lotus and Office Vision)
2) using the Domino directory would not work, as the Blackberry needs Internet address format and not Notes addressing
3) the Blackberry is designed to use a personal address book.

Ok, the third point is kind of lame, but it did actually point me to my final solution. What I decided to do was to create a Personal Address Book and call it the Blackberry Directory. I modified the pernames.ntf template and saved it as Blackberry.ntf then used that template to create my Blackberry directory and I modified the OV Users Directory and the Domino Directory template to include a special agent in each. I thought about doing the process automatically, but since it is relatively quick, I only have to do this infrequently, and deals with our main directories I decided to keep the process manual.

When I have to program a Blackberry for a user my procedure is as follows :

1)I first clear the current Blackberry entries by deleting all groups and users.
2)Next I go to the OV Users directory and select the people view. I select all and click the "Copy to Blackberry Directory " button. I then repeat the procedure for the groups.
3)I repeat the steps above (step 2)for the Domino Directory.
4)I switch to the Blackberry directory, select all users and press the "Convert to Internet Address Format" button.

On the Blackberry side:
1) Add the user with RIM in the cradle.
2) Generate Encryption Key
3) Open Blackberry Desktop Manager program, and turn on the Lotus Notes R5 Address Book synchronization and point it at Blackberry.nsf.
4) Perform PIM synchronization.

Now, any time someone addresses something to an associate in that directory it is sent out as (for example) DoeJ@andersonnews.com instead of John Doe/IT/CORP@Anderson. Not only that, but the user has access to both OV users and to our Lotus Notes users in the address book. This only takes me moments, and I only have to perform the procedure perhaps once per month so it has worked pretty well.

One last thing...the action will appear on the Agent's list if you do it the way I did. I added a local agent to the People and Groups view with the command @Command([ToolsRunMacro];"(Copy to Blackberry Directory)") in order to make a quick access button for myself present at the top right of the Address book in those views. And one last tip...just to speed you up...instead of copying the code below for the first agent copy your own address book's Copy to Local Address book agent, change it's name, and substitute your Blackberry Diretory's name (blackberry.nsf for example) for the occurance of Name.nsf. That will save you some typing :-) .

Good luck!


Agent one: Located in Domino Directory

Name--Copy to Blackberry Directory
Shared Agent
Agent Runs--Manually from Agent List
Which Documents should it act on? -- Selected Documents

Copy agent code below...it is Lotus Script...DO NOT COPY portions in 
{{**example**}} they indicate specific Objects to the agent.

****************************************

{{**Options**}}

Option Public

{{**Declarations**}}

Dim s As NotesSession
Dim sourcedb As NotesDatabase
Dim destdb As NotesDatabase
Dim sourcenote As NotesDocument
Dim sourceview As NotesView
Dim destnote As NotesDocument
Dim destview As NotesView
Dim documents As NotesDocumentCollection

Dim KeyValue As Variant
Dim DisplayKey As Variant
Dim DocsCopied As Integer
Dim Answer As Integer
Dim HowMany As Variant
Dim FormType As Variant
Dim PendingGroups() As Variant
Dim ProcessingGroup As Variant
Dim Refreshed As Integer
Dim StopProcessing As Variant

{{**Initalize**}}

Sub Initialize
	
	Set s = New NotesSession
	Set sourcedb = s.CurrentDatabase
	Set destdb = New NotesDatabase("", "Blackberry.nsf")
	Set destview = destdb.GetView("($Users)")
	Set sourceview = sourcedb.GetView("($Users)")
	Redim PendingGroups(0)
	
	Set documents = sourcedb.UnprocessedDocuments
	If documents.Count = 0 Then Exit Sub
	DocsCopied = 0
	For n = 1 To documents.Count
		Set sourcenote = documents.GetNthDocument(n)
		EvaluateDocument
		If StopProcessing Then Exit For
	Next
	
	If Ubound(PendingGroups) > 0 Then
		If Messagebox("Do you also want to copy all members of 
groups?", _
		4 + 32, "Copy Group") = 6 Then ProcessGroup
	End If
	
	If DocsCopied = 1 Then
		HowMany = "1 document was "
	Else
		HowMany = DocsCopied & " documents were "
	End If
	Messagebox HowMany & "copied to your personal Name and Address 
Book.", 0, "Copy"
	
End Sub

{{**Terminate**}}

Sub Terminate
	
End Sub

{{**ProcessDocument**}}

Sub ProcessDocument
	
	Set destnote = destview.GetDocumentByKey(Cstr(KeyValue(0)))
	If destnote Is Nothing Then
		Set destnote= sourcenote.CopyToDatabase(destdb)
		Call destnote.RemoveItem("MessageStorage")
		DocsCopied = DocsCopied + 1
	Else
		Select Case Messagebox(DisplayKey(0) & " already exists, 
do you want to replace it?", _
		4 + 32, "Copy")
		Case 6
			destnote.Remove(True)
			Set destnote= sourcenote.CopyToDatabase(destdb)
			Call destnote.RemoveItem("MessageStorage")
			DocsCopied = DocsCopied + 1
		Case 2
			StopProcessing = True
			Exit Sub
		Case Else
			If Not ProcessingGroup Then
				Exit Sub
			End If
		End Select
	End If
	
	If FormType(0) = "Group" Then
		g = Ubound(PendingGroups) + 1
		Redim Preserve PendingGroups(g)
		ListName = sourcenote.ListName
		PendingGroups(g) = ListName(0)
	End If
	
	If ProcessingGroup Then destview.Refresh
	
End Sub

{{**ProcessGroup**}}

Sub ProcessGroup
	
'We don't care if a group member is not found.  It could be because of 
obsolete lists.
	
	ProcessingGroup = True
	Forall p In PendingGroups
		Set sourcenote = sourceview.GetDocumentByKey(Cstr(p))
		If Not(sourcenote Is Nothing) Then
			Members = sourcenote.Members
			Forall m In Members
				Set sourcenote = 
sourceview.GetDocumentByKey(Cstr(m))
				If Not(sourcenote Is Nothing) Then
					EvaluateDocument
					If StopProcessing Then Exit Sub
				End If
			End Forall
		End If
	End Forall
	
End Sub

{{**EvaluateDocument**}}
Sub EvaluateDocument

     FormType = sourcenote.Type
     Select Case FormType(0)
     Case "Person"
          KeyValue = sourcenote.FullName
          DisplayKey = Evaluate("@Name([Abbreviate]; FullName)",
sourcenote)
          ProcessDocument
     Case "Group"
          KeyValue = sourcenote.ListName
          DisplayKey = Evaluate("@Name([Abbreviate]; ListName)",
sourcenote)
          ProcessDocument
     Case Else
          Messagebox "Only Person and Group documents can be copied.", 0 +
48, "Copy Documents"
     End Select

End Sub

*************End of 1st Agent***********

Agent two: Located in Blackberry Directory

Name--InternetFormat
Shared Agent
Agent Runs--Manually from Agent List
Which Documents should it act on? -- Selected Documents

Copy agent code below...this agent is in Formula Language
****************************************

{{**Action**}}


REM "Get the default for the listbox";
MailSystem = "5";
def := "Internet Mail";

REM "Get the type of mail system";
sys := "Internet Mail";

REM "Get username and first domain name";
x := @Explode(MailAddress; "@");
@If(x != ""; @Subset(x; 1) + "@"+ @Subset(@Subset(x; 2);-1); "");

REM "Include both any domain from MailAddress and any from MailDomain 
field";
d1 := @Explode(MailAddress+@If(MailDomain!="";"@"+MailDomain;"");"@");
d2 := @Elements(d1);
d3 := @If(d2 > 2; @Subset(d1; -(d2 - 2)); "");
d4 := @Trim(@Implode(d3; " @ "));
@If(d4 != ""; d4; @Environment("InternetDomain"));

FIELD MailAddress := InternetAddress + @If(InternetDomain != ""; " @ " + 
InternetDomain; "")

;SELECT @All

USER FEEDBACK TO THIS TIP

  • Can the user still have their personal names.nsf accessible on the Blackberry? We are looking at them now and would want to implement the same solution, but need to preserve the personal NAB too. —Bill Jones
  • REPLY FROM JOHN NEWCOMB: Here is how I set up mine.... I have a Blackberry.nsf on my local PC, as well as my personal address book (names.nsf). I created my Blackberry.nsf as my tip had previously outlined. In fact, nothing changes... until it's time to import the addresses into my Blackberry directory from my personal address book.

    I placed the exact same Copy to BlackBerry Directory agent used to port addresses from the Domino Directory into the Contacts view of my personal address book. Then I selected the contacts to port over and clicked the button... it was that simple. The insertion procedure is precisely the same as it is for the Domino Directory, only instead of placing it into the People view you place the agent into the Contacts view.

    OK, now this works so well for me because I program all the loaner RIMs from my PC. No directories or server issues to deal with. One thought might be, if they had to send this out to multiple people who were going to have their BlackBerry units and keep them... plus required their personal contacts... to go with a server based solution.

    Here's how they would do that:

    1) Create the Blackberry.ntf the way I outlined it in the tip.

    2) Create the Blackberry.nsf the way I outlined it in the tip...but create it on a server instead of the local machine you are using. This will be your master copy, and you will not send any personal contacts to it.

    3) Your Blackberry.nsf will remain exactly as it was from the previous tip.

    4) You will need to modify the Copy to Blackberry Directory agent that you will insert in your Domino Directory however. Right now it is set to find a Blackberry Directory on your Local PC...not on a server. Within the Initialize section of the LotusScript the 3rd/4th line down which reads:
    Set destdb = New NotesDatabase("","Blackberry.nsf")
    must be changed to your server's name including the organization.
    Set destdb = New NotesDatabase("server/organization","Blackberry.nsf")

    5) You will then insert the addresses into the Blackberry directory on the server and run the Set Internet Format agent to set all the addresses into their SMTP format.

    6) Replicate a copy of the database to the local PC of the user so they have their own copy of the Blackberry directory locally. This is the address book their Desktop software will point to and load on the RIM.

    7) Place the original Copy to Blackberry agent into the personal address book. This one will point to the local version for that user.

    8) Make sure that replication is ALWAYS one way between the master and slave copies of the Blackberry directory. We don't want personal contacts getting into the master copy. No updates from a client should ever be made to the server copy.

    9) Any updates should be made to the server copy, which will filter down through scheduled replication to the slave replicas.

    Two final safety tips:

    * Do all your formatting to SMTP addresses on the master replica... it could mess up personal contacts if it runs on them

    * Watch for entries in the personal contacts of a user that are for people within the company. Duplicate entries...even with extra information in one or the other... could cause addressing issues when a new memo is composed. —Hope that helps. John Newcomb

This was first published in November 2001

Dig deeper on Mobile Devices

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close