Change the Universal ID

The java agent code allows you to find a document by UNID and change it to another value. Once run, it will create a new document with that ID. Them you can delete the original.
Java


import lotus.domino.*;

public class JavaAgent extends AgentBase {

	public void NotesMain() {

		try {
			Session session = getSession();
			AgentContext agentContext = session.getAgentContext();
      			Database db = agentContext.getCurrentDatabase();
			Document pdoc = db.getDocumentByUNID("872572A7006EE958852574C0006C55EA");
        		pdoc.setUniversalID("FA4909FDF75EA786852574E100009C5E");
        		pdoc.save();

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

Written by Frank Joseph Brefere III

Posted by fbrefere001 on Tuesday October 21, 2008