Home > Domino Tips > Administrator > Address Book > Updating Groups With A Single Click
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ADDRESS BOOK

Updating Groups With A Single Click


Kevin Davis
08.05.1999
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


We have numerious groups that we maintain for each of our locations. It was
very time consuming keeping the groups updated or it didn't even get done. So,
I created this agent in the Public name and address book that would refresh the
groups for us. Here is the code.

Code

Sub Build_Fields

' Dim arrays for each location. This array will hold the names of all
' the prople at the location. This will be used to update the group document
Dim Syr_Names() As String
Dim Gb_Names() As String
Dim Cd_Names() As String
Dim Sa_Names() As String
Dim Fs_Names() As String
Dim Cn_Names() As String
Dim WS_Names() As String
Dim OR_Names() As String
Dim GS_Names() As String

' The arrays are not assigned a range until all the records are counted
' These vars will be used to cound the records
Dim Syr_Ctr As Integer
Dim Gb_Ctr As Integer
Dim Cd_Ctr As Integer
Dim Sa_Ctr As Integer
Dim Fs_Ctr As Integer
Dim Cn_Ctr As Integer
Dim WS_Ctr As Integer
Dim OR_Ctr As Integer
Dim GS_Ctr As Integer

Syr_Ctr = 0
Gb_Ctr = 0
Cd_Ctr = 0
Sa_Ctr = 0
Fs_Ctr = 0
Cn_Ctr = 0
WS_Ctr = 0
OR_Ctr = 0
GS_Ctr = 0

Dim Session As NotesSession
Set Session = New NotesSession
Dim db As NotesDatabase
Set db = New NotesDatabase("Corp/PSL/US","Names.nsf")
Dim view As NotesView
Set view = db.getview("People")
Dim Doc As NotesDocument
Set doc = view.GetFirstDocument
'using the "Location" field determine how many people are at each location.
While Not ( doc Is Nothing )
Location=Doc.Location
Select Case location(0)
Case "Syracuse"
Syr_Ctr = Syr_Ctr + 1
Case "Greensboro"
Gb_Ctr = Gb_Ctr + 1
Case "Concord"
Cd_Ctr = Cd_Ctr + 1
Case "Concord Warehouse"
Cd_Ctr = Cd_Ctr + 1
Case "San Antonio"
Sa_Ctr = Sa_Ctr + 1
Case "Canada"
Cn_Ctr = Cn_Ctr + 1
Case "Field Sales"
Fs_Ctr = Fs_Ctr + 1
Case "Ortronics"
OR_Ctr = OR_Ctr +1
Case "Watt Stopper"
WS_Ctr = WS_Ctr +1
Case "Gastonia"
GS_Ctr = GS_Ctr +1
End Select
Set doc = view.GetNextDocument( doc )
Wend

Syr_Ctr = Syr_Ctr - 1
Gb_Ctr = Gb_Ctr -1
Cd_Ctr = Cd_Ctr - 1
Sa_Ctr = Sa_Ctr -1
Fs_Ctr = Fs_Ctr -1
Cn_Ctr = Cn_Ctr -1
OR_Ctr = OR_Ctr -1
WS_Ctr = WS_Ctr -1
GS_Ctr = GS_Ctr -1

'Redim the arrays to be the size needed.
Redim Syr_Names(Syr_Ctr) As String
Redim Gb_Names(Gb_Ctr) As String
Redim Cd_Names(Cd_Ctr) As String
Redim Sa_Names(Sa_Ctr) As String
Redim Fs_Names(Fs_Ctr) As String
Redim Cn_Names(Cn_Ctr) As String
Redim OR_Names(OR_Ctr) As String
Redim WS_Names(WS_Ctr) As String
Redim GS_Names(GS_Ctr) As String

Syr_Ctr = 0
Gb_Ctr = 0
Cd_Ctr = 0
Sa_Ctr = 0
Fs_Ctr = 0
Cn_Ctr = 0
OR_Ctr = 0
WS_Ctr = 0
GS_Ctr = 0


' read the address book again this time storing the users name in the
array.
Set doc = view.GetFirstDocument
While Not ( doc Is Nothing )
Location=Doc.Location
OwnerName = Doc.Owner
Select Case location(0)
Case "Syracuse"
Syr_Names(Syr_Ctr) = OwnerName(0)
Syr_Ctr = Syr_Ctr + 1
Case "Greensboro"
Gb_Names(Gb_Ctr) = OwnerName(0)
Gb_Ctr = Gb_Ctr + 1
Case "Concord"
Cd_Names(Cd_Ctr) = OwnerName(0)
Cd_Ctr = Cd_Ctr + 1
Case "Concord Warehouse"
Cd_Names(Cd_Ctr) = OwnerName(0)
Cd_Ctr = Cd_Ctr + 1
Case "San Antonio"
Sa_Names(Sa_Ctr) = OwnerName(0)
Sa_Ctr = Sa_Ctr

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Address Book
Formula language button manages Deny Access list searches
Find a Lotus Notes user within NAB Deny Access groups
Synchronize LinkedIn contacts with Lotus Notes Domino
How to correct Lotus Notes public key mismatches in four easy steps
Creating a Lotus Notes Personal Address Book replica
Admin user unable to create NAB
@Transform formula for use in R6
Change NAB while maintaining integrity of documents
NAB: A key piece of the Domino administration puzzle
Build an extended directory catalog

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts