简体   繁体   English

Lotus Notes-邮件文档-Principal / From,INetFrom,SentTime,ReceivedTime字段

[英]Lotus Notes - Mail Document - Principal/From,INetFrom, SentTime, ReceivedTime fields

I have a requirement to fetch the SenderName,SenderEmail,ToNames,ToEmails,CCNames,CcEmails from a lotus notes document instance. 我需要从Lotus Notes文档实例中获取SenderName,SenderEmail,ToNames,ToEmails,CCNames,CcEmails。

Issue1 Looking into lotus.domino.Document API I found out the method getItems. 问题1研究 Lotus.domino.Document API,我发现了getItems方法。 When I write the elements to the system.out values for SenderEmail, ToEmails and CcEmails can be found. 当我将元素写入SenderEmail的system.out值时,可以找到ToEmails和CcEmails。

However values for SenderName(aka From), ToNames cannot be derived that easily. 但是,SenderName(aka From),ToNames的值不能轻易得出。

The values seems to be using an common name format. 这些值似乎使用通用名称格式。 For example check check my system.output below. 例如,检查下面的我的system.output。

Principal = "CN=Amaw Scritz/O=fictive"
$MessageID = "<OF0FF3779B.36590F8A-ON80257D15.001DBC47-65257D15.001DC804@LocalDomain>"
INetFrom = "AmawScritz@fictive.com"
Recipients = "CN=Girl1/O=fictive@fictive"
MailOptions = "0"
SaveOptions = "1"   
From = "CN=Amaw Scritz/O=fictive"
AltFrom = "CN=Amaw Scritz/O=fictive"    
SendTo = "CN=Girl1/O=fictive@fictive"
CopyTo = "CN=Girl2/O=fictive@fictive"
BlindCopyTo = ""
InetSendTo = "Girl1@fictive.com"
InetCopyTo = "Girl2@fictive.com"    
$Abstract = "sasdasda"  
$UpdatedBy = "CN=Amaw Scritz/O=fictive" 
Body = "Hello World"

The question is how can I get 'Amaw Scritz' from the common name 'CN=Amaw Scritz/O=fictive'. 问题是如何从通用名称“ CN = Amaw Scritz / O = fictive”中获得“ Amaw Scritz”。 Is there any look up mechanism that can be used. 有没有可以使用的查找机制。 (I would prefer to have a option other than doing a substring of the common name) (我希望有一个选项,而不是使用通用名称的子字符串)

Issue2 is it possible to retrieve SentTime and ReceivedTime from mail document instance? Issue2是否可以从邮件文档实例中检索SentTime和ReceivedTime? I know that there are two methods called getCreated and getLastModified. 我知道有两种方法称为getCreated和getLastModified。 getCreated can be loosely associated with the SentTime and getLastModified can be loosely associated with ReceivedTime. getCreated可以与SentTime松散关联,而getLastModified可以与ReceivedTime松散关联。 Are there are other ways to get times for SentTime and ReceivedTime. 还有其他获取SentTime和ReceivedTime时间的方法。

Issue3 How can one distinguish whether a mail document is a Sent mail or a Received Mail? Issue3如何区分邮件文档是已发送邮件还是已接收邮件?

Issue1 第1期
You can use Name class. 您可以使用Name类。
Here example from this link : 这里是此链接的示例:

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

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

      // (Your code goes here) 

      // Create a hierarchical name
      Name nam = session.createName(
        "CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US");

      // Returns:
      // John B Goode
      // John B Goode/Sales/East/Acme/US
      // CN=John B Goode/OU=Sales/OU=East/O=Acme/C=US
      System.out.println(nam.getCommon());
      System.out.println(nam.getAbbreviated());
      System.out.println(nam.getCanonical());

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

Issue2 第2期
Use values of PostedDate field and DeliveredDate field of mail document. 使用邮件文档的PostedDate字段和DeliveredDate字段的值。

Issue3 问题3
Check that $Inbox folder contains your mail document. 检查$Inbox文件夹是否包含您的邮件文档。 Or take a look at Dave Delay answer . 或看看Dave Delay答案

I agree with @nempoBu4 on Issues 1 and 2. I disagree with the answer to Issue 3. A received message can be removed from the inbox, so checking $Inbox doesn't help you distinguish between sent and received messages. 我同意问题1和2上的@ nempoBu4。我不同意问题3的答案。可以从收件箱中删除收到的消息,因此检查$ Inbox不能帮助您区分已发送和已接收消息。

Assuming you have the document open, the best approach is to check two items. 假设您已打开文档,最好的方法是检查两个项目。 Sent and received messages both have a PostedDate item, but only a received message has a DeliveredDate item. 已发送和已接收邮件均具有“已发布日期”项目,但仅已接收邮件具有“已传递日期”项目。 Incidentally, a draft message has neither PostedDate or DeliveredDate. 顺便说一句,草稿邮件既没有PostedDate也没有DeliveredDate。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM