Lotus Traveler and iPhone agenda mark private

One of my manager dislikes the switch from blackberry to iphone because he couldn’t set his calendar entries as private.

Of course you should care about the issues of you VIP.

To manage this, I have done the following :

1. Add a view to his database which display the caldendar entries with a “#” in the subject.

2. Create an agent in a second database which monitor a list of mail databases every 5 minutes.

3. The agent process all the entries in the view and remove then from the view. Each document is mark as private…

The VIP has only to put a “#” in the description of the caldendar entry.

Simple but not perfect, there is a window of 5 minutes in which the document is not private… I haven’t found a better handler to manage it…

I could give you the database if you are interested.

Greetings

Check if a OOO agent is activated on lotus notes databases…

This week I was asked to get all the activated out of office agent. I have activated the ooo agent on the server, so getting the info from the profile is not a solution.

If you launch your administrator client you could see that there is a column which indicates if the ooo is activated. This means that the property is set on the database file attribute.

 

 

Reading the web I found this post :

http://www-10.lotus.com/ldd/nd85forum.nsf/DateAllFlatWeb/37db9f50dc3f5515852576110067fb03?OpenDocument

So you can write this in a simple function :

Public Function isOOO(db as notesdatabase) As Integer
                On Error Goto errorHandler        
                If app.se.NotesBuildVersion < 379 Then
                        Call app.logError(“too old version 8.5x”)
                        Exit Function
                End If
                
                ‘ *** DBOPT_OUTOFOFFICEENABLED passed as a number to compile in R7 client
                If db.GetOption( 74 ) Then
                        isOOO = True
                Else
                        isOOO = False
                End If
                Exit Function
errorHandler:
                Dim sMsg As String
                sMsg =   Typename(Me) + “-” + Error + “-” +Cstr(Err()) & ” at line number ” & Erl() &  ” ” & Lsi_info(12) & ” ” & Lsi_info(2)
                Call app.logErrorExt(sMsg, Nothing)        
End Function

Agent to create a backup of you names.nsf weekly

As an administrator, I often need to put me back in time to check something on the domino infrastructure. My Domino Domain is very small so I can afford to make a backup of my names.nsf every week.

This class, creat a copy of each documents of the names.nsf, zip it and attach it to a document… enjoy !


import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import lotus.domino.*;
import java.io.*;
import java.util.zip.*;

/* -----------------------------------------------------------------------------------------------------------------------
* Class : JavaAgent
* Date : 12.01.2011
* Author : Pierre Koerber
* Desc. : Permet de faire un backup du PAB et de le zipper.
*/

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {

Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// get the curr db
Database curDb ;
curDb = agentContext.getCurrentDatabase() ;

// (Your code goes here)
Database db ;
db = session.getDatabase(curDb.getServer(), "names.nsf") ;

DateTime timenow = session.createDateTime("Today");
timenow.setNow();

String sName = new String("") ;
String sZipName = new String("") ;
sName = db.getFilePath() ;

System.out.println("OS current temporary directory is " + System.getProperty("java.io.tmpdir"));

sName = System.getProperty("java.io.tmpdir") ;
sName = sName + "names_backup_" + timenow.getDateOnly().replace('.', '_') + ".nsf";

sZipName = System.getProperty("java.io.tmpdir") ;
sZipName = sZipName + "names_backup_" + timenow.getDateOnly().replace('.', '_') + ".zip";

// copy the database
System.out.println("Create a copy of the names.nsf =" + db.getServer() + "-" + db.getFilePath()) ;

this.deleteIfExist(sName) ;
Database newDb ;
newDb = db.createCopy("", sName) ;

// copy all the documents
DocumentCollection dc ;
Document d ;

dc = db.getAllDocuments() ;
d = dc.getFirstDocument() ;

while(d != null){

// No deletion stubs...
if (d.isDeleted() == false){
d.copyToDatabase(newDb) ;
}
d = dc.getNextDocument() ;
}

// Compress the stuff
System.out.println("Compressing file from " + sName + " to " + sZipName) ;

// delete the files if exist
this.deleteIfExist(sZipName) ;

// compress the database
this.doZipExt(sName,sZipName) ;

// create a document and attach the backup
System.out.println("Attach everything to the archive document") ;
Document doc ;
doc = curDb.createDocument() ;

doc.replaceItemValue("backupName", "Sauvegarde names.nsf of " + db.getServer() + " - " + timenow.getDateOnly()) ;
doc.replaceItemValue("Subject", doc.getItemValueString("backupName")) ;
doc.replaceItemValue("backupDate", timenow) ;
doc.replaceItemValue("agentName", agentContext.getCurrentAgent().getName()) ;
doc.replaceItemValue("Form", "backup") ;

lotus.domino.RichTextItem rt = doc.createRichTextItem("Body") ;
rt.embedObject(EmbeddedObject.EMBED_ATTACHMENT,null, sZipName, "archive") ;

// Save the document
doc.save(true, true);

// delete the database
this.deleteIfExist(sName) ;
this.deleteIfExist(sZipName) ;
System.out.println("Done");

} catch(Exception e) {
e.printStackTrace();
}
}

public void deleteIfExist(String sName){
File f = new File(sName) ;
if (f.exists()) {
System.out.println("File : " + sName + " deleted");
f.delete() ;
}

}

public void doZipExt(String sFileName, String sZipFileName) throws IOException{
System.out.println("Creating zip file :" + sZipFileName) ;

File sourceFile = new File(sFileName) ;

// Create our zip file
ZipOutputStream zipfile = new ZipOutputStream(new FileOutputStream(sZipFileName));
FileInputStream filetozip = new FileInputStream(sFileName);
zipfile.putNextEntry(new ZipEntry(sourceFile.getName()));

// Loop through the contents writing it to the zip file output stream.
int len;
byte[] buffer = new byte[1024];

while ((len = filetozip.read(buffer)) > 0) {
zipfile.write(buffer,0,len);
}

// Close the entry and the current file.
zipfile.closeEntry();
filetozip.close();
// When done, close the zip file.
zipfile.close();
}

}

Lotus notes FT-Search, looking for non present field…

I wanted to do a lotusscript FT-search of the non existence of a field in documents… let’s begin some head aches… hopefully with google I found quickly a solution.

NOT [fieldname] is present

Thanks to Alan… here the full post :

http://www.alanlepofsky.net/alepofsky/alanblog.nsf/dx/searching-for-blank-fields?opendocument&comments

show nlcache reset – reset du names lookup domino

Hello, this comand will reset the domino names.nsf cache ! it will allow the user that you’ve just put in a group to have access to an app… be careful, this command has a significant cost on your server !

Greetings

Lotus Notes : simple soft delete form your application

Hi,

In our application it’s a common task to delete document but before granting the deletion, we want to be able to discard the modification…

Here the simpliest soft delete agent in your database, it juste rename the form name which should be enough in every lotus application.

FIELD Form := "DELETED_" + Form;
SELECT @All

Just put all this code in a lotus notes agent and you’re done !

Greetings.

How to import PNG images in Lotus Notes 6.x and 7.x

When trying to include png images, you will be stuck with these old clients… one simple workaround found on the www…

Lotus Notes does not support importing of PNG images into Rich Text by default but you can add that feature by adding the following line to your Notes Clients notes.ini file:

EDITIMP18=PNG Image,0,_IW4W,,.PNG,,8,