Lotus Notes — рабочий инструмент программиста.

Обсуждения программирования на Lotus Notes/Domino

YUI 2.6.0 via Webdav

leave a comment »

I loaded the Yahoo User Interface via WebDav, into a Domino Database. Works well, and you don’t need to beg the Administrator to put the files on the server for you.

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Голые знаменитости

Written by lotusnotes

Январь 28, 2009 at 1:50

Опубликовано в Lotus Notes

Creating an Empty Document Collection — Undocumented Code

leave a comment »

Have you ever wanted to build your own custom document collections? I have, imagine my surprise when I came across this undocumented code within the R8 Mail Template which lets you do just that: CreateDocumentCollection() This handy little timesaver allows you to quickly initialize an empty collection. Here is an example: Dim MyCol As NotesDocumentCollection
Set MyCol = db.CreateDocumentCollection() You are now free to add documents to your empty collection. Note: Before this method the only way I knew of to achieve this was to "getalldocumentsbykey" using a key that does not exist.

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Written by lotusnotes

Январь 28, 2009 at 1:50

Опубликовано в Lotus Notes

Refresh All Views

leave a comment »

Sub RefreshAllViews(db As NotesDatabase)
‘ posted to http://www.openntf.org/Projects/codebin/codebin.nsf/0/C4BA0B2EC810D7EE8625751C0051534A
‘ written by Mike Mortin, 20081211
Dim s As New NotesSession ‘ use the current db if none is specified
If db Is Nothing Then set db = s.CurrentDatabase ‘ refresh all views
Forall view In db.Views
‘ Print "Refreshing view ‘" & view.Name & "’"
Call view.Refresh
End Forall
End Sub

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Written by lotusnotes

Январь 28, 2009 at 1:50

Опубликовано в Lotus Notes

Converting Domino view XML to hierarchical style

leave a comment »

The view XML you get using ?ReadViewEntries is descriptive. The tree structure of view categories is maintained via position attribute, not via XML structure. I needed a view XML with tree structure to display a categorized Notes view in TreeView component in .NET. This is the XSLT that can do the trick. Simply transform your view XML with this XSLT, and you get a hierarchical XML. The first column value in the view entry is loaded into a "value" attribute, UNID is loaded into "unid" attribute.

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Written by lotusnotes

Январь 28, 2009 at 1:50

Опубликовано в Lotus Notes

Clear Lotus Notes local cache (cache.ndk) with LotusScript

leave a comment »

Embed this LotusScript in a button or in the postopen sub of a database script. With it, users can clear their local caches without deleting their cache.ndk files. Here is the code : ************************** Dim WorkSpace As New NotesUIWorkspace
Dim DbCache As NotesDatabase
Dim AllDocs As NotesDocumentCollection
Dim Doc, nextDoc As NotesDocument
Dim i As Integer On erreur Goto ErrorHandling Set DbCache = New NotesDatabase ("", "cache.ndk")
Set AllDocs = DbCache.AllDocuments
If AllDocs.Count > 0 Then
Print "deleting documents from cache.ndk …"
Set Doc = AllDocs.GetFirstDocument
While Not ( Doc Is Nothing )
i = i + 1
Set NextDoc = AllDocs.GetNextDocument ( Doc )
Print "deleting documents from cache (" & Cstr (i) & "/" & Cstr ( AllDocs.Count ) & ")"
Call Doc.RemovePermanently ( True )
Set Doc = NextDoc
Wend
End If
Print "Compacting cache.ndk"
Call DbCache.Compact Exit Sub ErrorHandling : Resume
Call WorkSpace.Prompt (1, "Cache.ndk Optimization", "An error has occured." ) ************************** Pascal LUCAS. http://www.upteamind.fr

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Written by lotusnotes

Январь 28, 2009 at 1:49

Опубликовано в Lotus Notes

Sample Access to OpenOffice or Lotus Symphony

leave a comment »

This database contains a small sample application, which shows you, how you can access OpenOffice or Symphony from within LotusScript by using the COM-UNO Bridge, that comes with these two products. Until today, documentation that is good for most of us LS programmers is sparse. And samples are rare. This database contains an application, which almost immediately with some small adaptations may be used to produce invoices, that will be generated through OOo/Symphony. It will attach an ODF-File and a PDF-File to the document, from which you have generated them. The code that is doing that shows the most important things you need to know to be able to enhance Notes with e.g. printing ……. (Yes, notes is able to print that way ……..) . Many thanks to Justin Freeman of Agileware, Australia, which has put this example into Public Domain many years ago. I then have adapted it to use ODF instead of the OOo 1.1 format, that Justin was confronted with back then. I assured, that the code itself is compatible with Symphony too, but unfortunately, I could not get it running reliably under Notes-Built-In Symphony with Notes 8.5 Beta 2. It looks like a quirk in the Symphony Implementation (so I have to alert IBM about that).

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Written by lotusnotes

Январь 28, 2009 at 1:49

Опубликовано в Lotus Notes

Delete BES State Databases

leave a comment »

‘Options
Option Declare ‘ Declarations
‘%INCLUDE "LsConst.LSS"
‘ msgBoxOptions = MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2
Const msgBoxOptions = 4 + 32 + 256
‘ yes = IDYES
Const yes = 6 Sub Click(Source As Button)
‘ posted to http://www.openntf.org/projects/codebin/codebin.nsf/CodeByDate/3307822D17936284862575000058210D
‘ written by Mike Mortin, 20081015 Dim ui As New NotesUIWorkspace
Dim uidoc As NotesuiDocument
Dim db() As NotesDatabase
Dim user As String, serverList() As String, msg As String
Dim index As Long, numDbs As Long
Dim deleteDbs As Boolean ‘ set up
Set uidoc = ui.CurrentDocument
user = uidoc.FieldGetText("firstname") & " " & uidoc.FieldGetText("lastname")
deleteDbs = False ‘ get the server names
If 0 Then
‘ hard code the server names
Redim serverList(0 To 2)
serverList(0) = "BES01/SVR/CA"
serverList(1) = "BES02/SVR/CA"
serverList(2) = "BES03/SVR/CA"
Else
‘ load from a group
Dim s As New NotesSession
Dim doc As NotesDocument
Dim key(0) As Variant
key(0) = "BlackBerryServers" ‘ <— put the group name that contains your BlackBerry servers
Set doc = GetDocFromDb(s.CurrentDatabase, "Groups", key, True)
Redim serverList(Lbound(doc.Members) To Ubound(doc.Members))
For index = Lbound(doc.Members) To Ubound(doc.Members)
serverList(index) = doc.Members(index)
Next
End If ‘ grab each database
Redim db(Lbound(serverList) To Ubound(serverList))
For index = Lbound(serverList) To Ubound(serverList)
Set db(index) = GetDbByTitle(serverList(index), user)
If Not db(index) Is Nothing Then numDbs = numDbs + 1
Next If numDbs = 0 Then
‘ tell admin that there are no state dbs found
Messagebox("No State database for " & user & " were found.")
Else
If numDbs = 1 Then
‘ find the active Db
For index = Lbound(serverList) To Ubound(serverList)
If Not db(index) Is Nothing Then Exit For
Next ‘ let the admin know which server the db was found on and prompt to delete
msg = "State database for " & user & " only found on " & db(index).Server & ". Do you want to delete this file?"
Else
‘ prompt to delete all replicas
msg = "Are you sure you want to delete the " & numDbs & " state databases for " & user & "?"
End If If Messagebox(msg, msgBoxOptions) = yes Then deleteDbs = True
End If ‘ delete the dbs
If deleteDbs Then
For index = Lbound(serverList) To Ubound(serverList)
If Not db(index) Is Nothing Then db(index).Remove
Next
End If
End Sub Function GetDbByTitle(serverName As String,userName As String) As NotesDatabase
On Error Goto ExitSub
Dim server As NotesDbDirectory
Dim db1 As NotesDatabase, db2 As NotesDatabase ‘ Find db on server
Set server = New NotesDbDirectory(serverName)
Set db1 = server.GetFirstDatabase(DATABASE)
While Not (db1 Is Nothing)
If userName = db1.Title Then
If db2 Is Nothing Then
Set db2 = db1
Else
Msgbox "Duplicate db title found on "& serverName
Exit Function
End If
End If
Set db1 = server.GetNextDatabase
Wend ExitSub: Set GetDbByTitle = db2
Exit Function
End Function

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Written by lotusnotes

Январь 28, 2009 at 1:49

Опубликовано в Lotus Notes