以编程方式为莲花笔记创建约会 [英] Creating an appointment for lotus notes programmatically

查看:219
本文介绍了以编程方式为莲花笔记创建约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建约会(日历条目),并自动将其分发给特定的被邀请者。

I need to create an appointment (Calendar entry) and distribute it to certain invitees automatically.

我现在有两个问题:

1)日历项目不会出现在椅子。我已经解决这个问题,添加椅子作为必要的参加者,发送他们通知确认,但我想知道如何自动添加。

1) The calendar entry does not appear on the calendar for the chair. I have worked around this by adding the chair as a required attendee which sends them a notice to confirm, however I would like to know how to add it automatically.

2)受邀者正在发送邀请,但无法确认邀请。 Lotus会抛出一个错误,说他们无法处理邀请,因为他们的邮件文件中不存在。

2) The invitees are being sent an invitation, but they can not confirm it. Lotus throws an error saying that they cannot process the invitation because the even does not exist in their mail file.

我的代码在JAVA中,但如果需要,我可以移植到Lotusscript或公式。我只需要得到它的工作。

My code is in JAVA, but I can port to Lotusscript or Formula if need be. I just need to get it working.

import java.util.GregorianCalendar;

import lotus.domino.AgentBase;
import lotus.domino.Database;
import lotus.domino.Document;
import lotus.domino.Session;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

      try {
          Session s = getSession();
          Database db = s.getDatabase("server", "maildatabase.nsf", false);
          String user = s.getUserName();

          Document doc = db.createDocument();
          doc.replaceItemValue("Form", "Appointment");
          doc.replaceItemValue("AppointmentType", "3");
          doc.replaceItemValue("$PublicAccess", "1");

          doc.replaceItemValue("Subject", "New Meeting"); 
          doc.replaceItemValue("CALENDARDATETIME", s.createDateTime(new GregorianCalendar(2012, 7, 24, 9, 0)).getLocalTime());
          doc.replaceItemValue("Body", "an invitation");

          doc.replaceItemValue("StartDate", s.createDateTime("08/24/2012").getLocalTime());
          doc.replaceItemValue("EndDate", s.createDateTime("08/24/2012").getLocalTime());
          doc.replaceItemValue("StartTime", s.createDateTime("09:00:00 AM").getLocalTime());
          doc.replaceItemValue("EndTime", s.createDateTime("10:00:00 AM").getLocalTime());
          doc.replaceItemValue("StartDateTime", s.createDateTime(new GregorianCalendar(2012, 7, 24, 9, 0)));
          doc.replaceItemValue("EndDateTime", s.createDateTime(new GregorianCalendar(2012, 7, 24, 10, 0)));

          doc.replaceItemValue("RequiredAttendees", "Invitee/company");
          doc.appendItemValue("RequiredAttendees",user);

          doc.replaceItemValue("SendTo", "Invitee/company");
          doc.appendItemValue("SendTo",user);
          doc.replaceItemValue("EnterSendTo", "Invitee/company");
          doc.appendItemValue("EnterSendTo",user);
          doc.replaceItemValue("From", user);
          doc.replaceItemValue("Principal",user);
          doc.replaceItemValue("Chair", user); 
          doc.replaceItemValue("Location", "location test");


          doc.computeWithForm(true, false);
          doc.save(true,false,false);

          String sendTo = doc.getItemValueString("SendTo");
          doc.send(false, sendTo);

      } catch(Exception e) {
          System.out.print(e.getMessage());
       }
   }
}

谢谢。

推荐答案

我结束了这样做。它强制用户设置日期和手动发送邀请,但它的最接近我可以得到。我不能使用iCal附件,因为我需要每个人都为同一事件的重新安排目的的一部分。

I ended up doing this. It forces the user to set the dates and send the invitations manually, but its the closest I could get. I could not use the iCal attachment because I need everyone to be part fo the same event for rescheduling purposes.

    @Command([Compose];"" : "mailfile.nsf";"Calendar Entry");
    @PostedCommand([EditGotoField];"Subject");
    @PostedCommand( [EditInsertText]; "Title" );
    @PostedCommand([EditGotoField];"EnterSendTo");
    @PostedCommand([EditInsertText]; "Bob Test");
    @PostedCommand([EditGotoField];"Location");
    @PostedCommand([EditInsertText]; "Location" );
    @PostedCommand([EditGotoField];"StartTime");
    @PostedCommand([EditInsertText]; @Text(@Time(9;0;0)));
    @PostedCommand([EditGotoField];"Body");
    @PostedCommand([EditInsertText];@UpperCase("Set Start and End Dates to: " + @Text(@Adjust(BidDay;0;0;-1;0;0;0))));

这篇关于以编程方式为莲花笔记创建约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆