使用 Domino REST API 更新邮件草稿导致邮件出现在发送文件夹中

Updating mail draft using Domino REST API causes message to appear in Send folder

我正在使用 Domino Mail REST API 并且能够创建一个新的草稿邮件,它会出现在 Drafts 文件夹中。

当我更新草稿邮件时,它会出现在“已发送”文件夹中,并且在“草稿”文件夹中不再可见。

这是出乎意料的。消息未发送。我还尝试将 From 和 To 字段设置为 null,结果始终相同。

部分代码: Gson gson = new Gson(); 字符串 json = gson.toJson(消息);

        // if message has an id then do update
        if (href != null && href.trim().length() > 0) {
            url = createFullQualifiedRequestUrl(href);
            HttpPut request = new HttpPut(url);
            request.setHeader("Content-Type", "application/json");
            request.setEntity(new StringEntity(json, "utf-8"));
            response = this.executeRequest(request, username);

        } else {
            MailboxFolder folder = getFolder("drafts", username);
            url = this.createFullQualifiedRequestUrl(folder.getLink()
                    .getHref());
            HttpPost request = new HttpPost(url);
            request.setHeader("Content-Type", "application/json");
            request.setEntity(new StringEntity(json, "utf-8"));
            response = this.executeRequest(request, username);
        }

        if (response != null) {
            SendMessageResult result = parseResponse(response);
            if(href != null)
                result.setLocation(href);
            return result;
        }

很可能,您的问题是由将 PostedDate 项设置为非空值的原因引起的。

已发送 "folder" 不是文件夹。这是一种观点。草稿"folder"也是如此。这也是一种看法。如果您进入 Domino Designer 并查看视图,您可以看到它们的选择公式。你会看到它们看起来像这样

已发送

SELECT DeliveredDate = "" & PostedDate != "" & !(@IsMember("S"; ExcludeFromView))

草稿

SELECT PostedDate = "" & $MessageType = "" & @IsNotMember("D" : "A"; ExcludeFromView) & ISMAILSTATIONERY != 1 & Form != "Group" & Form != "Person"

请注意,这些取自相当旧版本的邮件模板,因此您实际看到的可能有所不同,但 AFAIK 这个想法并没有改变。如果文档包含非空的 PostedDate 项并且 DeliveredDate 项为空或缺失且未标记为排除,则文档将出现在 Sent 中。如果文档不包含这两个日期项目中的任何一个,则文档出现在草稿中,没有标记为排除,不是文具,也不是组或个人文档。这里的共同点是对 PostedDate 项的依赖。

这是 REST 邮件中的错误 API,理查德对根本原因的看法是正确的。该错误将在 extension library (901v00_12) 的下一个版本中修复。我不能确切地说第 12 版何时可用,但应该很快。