WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Set Groupwise Contacts Link


;The GroupWise 6.5 Contacts folder is a shortcut to an Address Book. 
;By default, the Contacts folder works with the Frequent Contacts address book. 
;This script using GroupWise API and WinBatch(2002f)OLE commands, changes the link of the Contacts folder from Frequent Contacts
;to the Address Book named after the user (Root Folder Name).
;If an address book named after the user does not exist, one is created.

GWApp = ObjectOpen("NovellGroupWareSession") ;Open GroupWise API Session 
GWRootAccount = GWApp.Login("", "") ;May need to have GroupWise or Notify running, or insert user name and password in high security environment
RootName=GWRootAccount.RootFolder
UsrName=Rootname.name ;Gets Root folder name (User Name)
;Message("UsrName",UsrName)

ContactsFolder= GWRootAccount.Contacts
ContBook=ContactsFolder.ContactsAddressBook
CurrName=ContBook.name ;Gets Current Contacts link
;Message("CurrName",CurrName)
If CurrName!=UsrName Then Gosub FolderSet ;If Current link not user name then go fix it

ObjectClose(GWApp) ;Close Session
Exit


:FolderSet
;Message(CurrName,UsrName)

:Retry
GWABooks = GWRootAccount.AddressBooks ;Get list of Address Books
GWACount=GWABooks.Count ;Get count of Address Books
For Y = 1 To GWACount
GBook = GWABooks.item(Y) 
GWBookName%Y% = GBook.name ;Get name of Book for position 'Y'
;Message("GWBookName%Y%",GWBookName%Y%)
If GWBookName%Y%==UsrName Then ;If name of Book = user, go set Contacts link
;Message("GWBookName%Y%",GWBookName%Y%)
Gosub ContactsFolder
break
Else 
If Y==GWACount Then ;If Y = Number of address books, there is no book with user name
;Message("No Match","No Match")
GWABooks.Add(UsrName) ;Make a book with user name, then go to top of book count and get its position
Goto Retry
break
Endif
Endif
Next


Return

:ContactsFolder
GWContacts= GWRootAccount.Contacts
GWCurrBook=GWContacts.ContactsAddressBook
GWContacts.ContactsAddressBook= GBook ;Set Contacts folder to user name address book
GWRootAccount.refresh( )
Return

Article ID:   W16166
File Created: 2004:03:30:15:43:02
Last Updated: 2004:03:30:15:43:02