在 SQL 中存储 Exchange 2010 电子邮件

发布于 2024-09-01 19:35:28 字数 499 浏览 4 评论 0原文

我有一个应用程序,它将在收到电子邮件时启动程序流程。我需要将电子邮件链接到我的应用程序,我将通过消息上的自定义属性来完成此操作。

然后我需要永久存储该电子邮件以供参考。由于 Exchange 2010 仅支持邮箱中的 10Gb 和 100,000 个项目(不使用 PST 文件),因此我需要将邮件放入更永久的存储 SQL 中。

我正在运行 SQL 2005,我想将电子邮件存储在那里,但不是作为图像,这样我就可以在需要时搜索它。当我使用 Exchange Web 服务获取电子邮件时,我已经拥有该消息的完整 XML。我认为将其存储在一个 XML 字段中,该字段具有与其关联的消息 XML 模式(以帮助提高性能)应该为我提供最佳解决方案。

我的问题是获取消息的 XML 模式。我似乎在任何地方都找不到它,而且似乎没有太多关于将消息放入 SQL 的在线内容。

我的做法是错误的还是有更好的解决方案?该邮箱预计每年会收到超过 60 万封电子邮件。

任何帮助或帮助都会很高兴得到。

谢谢, 麦克风

I have an application which will start a program flow with the arrival of an email. I will need to link the email to my application, which I'm going to do via a custom property on the message.

I will then need to store the email for reference forever. As Exchange 2010 supports only 10Gb and 100,000 items in a mailbox (without using PST files), I need to get the message into a more permanent store, SQL.

I'm running SQL 2005 and I want to store the email in there but not as an image, so I can search it if I need to. As I am using Exchange Web Services to get the email I already have the full XML for the message. I figure storing it in a XML field which has the Message XML schema associated to it (to help with performance) should give me the best solution.

My issue is getting the XML schema for a Message. I can't seem to find it anywhere and there doesn't seem to be much online content for putting messages into SQL.

Am I going about this all wrong or is there a better solution for me? The mailbox is forecast to receive over 600k emails a year.

Any help or assistance will be happily received.

Thanks,
Mike

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

唯憾梦倾城 2024-09-08 19:35:28

我使用 XMLSpy 生成基于 XML 文件的架构。它不会是完美的,但它对我有用。

XMLSpy 生成的内容比下面的多,但它限制太多,而且 SQL 也没有验证它。所以我去掉了一些额外的东西并保持它的美观和简单。

这是它生成的 MessageType XML Schema;

<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2010 rel. 3 (x64) (http://www.altova.com)-->
<xs:schema xmlns:n1="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:import namespace="http://schemas.microsoft.com/exchange/services/2006/types" schemaLocation="messagetype1.xsd"/>
    <xs:element name="MessageType">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="n1:ItemId"/>
                <xs:element ref="n1:ParentFolderId"/>
                <xs:element ref="n1:ItemClass"/>
                <xs:element ref="n1:Subject"/>
                <xs:element ref="n1:Sensitivity"/>
                <xs:element ref="n1:DateTimeReceived"/>
                <xs:element ref="n1:Size"/>
                <xs:element ref="n1:Importance"/>
                <xs:element ref="n1:IsSubmitted"/>
                <xs:element ref="n1:IsDraft"/>
                <xs:element ref="n1:IsFromMe"/>
                <xs:element ref="n1:IsResend"/>
                <xs:element ref="n1:IsUnmodified"/>
                <xs:element ref="n1:DateTimeSent"/>
                <xs:element ref="n1:DateTimeCreated"/>
                <xs:element ref="n1:DisplayCc"/>
                <xs:element ref="n1:DisplayTo"/>
                <xs:element ref="n1:HasAttachments"/>
                <xs:element ref="n1:Culture"/>
                <xs:element ref="n1:EffectiveRights"/>
                <xs:element ref="n1:LastModifiedName"/>
                <xs:element ref="n1:LastModifiedTime"/>
                <xs:element ref="n1:IsAssociated"/>
                <xs:element ref="n1:WebClientReadFormQueryString"/>
                <xs:element ref="n1:ConversationId"/>
                <xs:element ref="n1:Sender"/>
                <xs:element ref="n1:IsReadReceiptRequested"/>
                <xs:element ref="n1:ConversationIndex"/>
                <xs:element ref="n1:ConversationTopic"/>
                <xs:element ref="n1:From"/>
                <xs:element ref="n1:InternetMessageId"/>
                <xs:element ref="n1:IsRead"/>
                <xs:element ref="n1:ReceivedBy"/>
                <xs:element ref="n1:ReceivedRepresenting"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

I used XMLSpy to generate a schema based on the XML file. It won't be perfect but it works for me.

XMLSpy generated more than the below but it was too restrictive and also SQL didn't validate it. So I took out some of the extras and kept it nice and simple.

Here is the MessageType XML Schema it generated;

<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2010 rel. 3 (x64) (http://www.altova.com)-->
<xs:schema xmlns:n1="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:import namespace="http://schemas.microsoft.com/exchange/services/2006/types" schemaLocation="messagetype1.xsd"/>
    <xs:element name="MessageType">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="n1:ItemId"/>
                <xs:element ref="n1:ParentFolderId"/>
                <xs:element ref="n1:ItemClass"/>
                <xs:element ref="n1:Subject"/>
                <xs:element ref="n1:Sensitivity"/>
                <xs:element ref="n1:DateTimeReceived"/>
                <xs:element ref="n1:Size"/>
                <xs:element ref="n1:Importance"/>
                <xs:element ref="n1:IsSubmitted"/>
                <xs:element ref="n1:IsDraft"/>
                <xs:element ref="n1:IsFromMe"/>
                <xs:element ref="n1:IsResend"/>
                <xs:element ref="n1:IsUnmodified"/>
                <xs:element ref="n1:DateTimeSent"/>
                <xs:element ref="n1:DateTimeCreated"/>
                <xs:element ref="n1:DisplayCc"/>
                <xs:element ref="n1:DisplayTo"/>
                <xs:element ref="n1:HasAttachments"/>
                <xs:element ref="n1:Culture"/>
                <xs:element ref="n1:EffectiveRights"/>
                <xs:element ref="n1:LastModifiedName"/>
                <xs:element ref="n1:LastModifiedTime"/>
                <xs:element ref="n1:IsAssociated"/>
                <xs:element ref="n1:WebClientReadFormQueryString"/>
                <xs:element ref="n1:ConversationId"/>
                <xs:element ref="n1:Sender"/>
                <xs:element ref="n1:IsReadReceiptRequested"/>
                <xs:element ref="n1:ConversationIndex"/>
                <xs:element ref="n1:ConversationTopic"/>
                <xs:element ref="n1:From"/>
                <xs:element ref="n1:InternetMessageId"/>
                <xs:element ref="n1:IsRead"/>
                <xs:element ref="n1:ReceivedBy"/>
                <xs:element ref="n1:ReceivedRepresenting"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
似狗非友 2024-09-08 19:35:28

您可以将其存储在 XML 列中,对该列建立索引并进行搜索。

至于消息 xml 模式,可能有一个,但我找不到它。

you can store it in an XML column, index that column and search through it.

as for the message xml schema, there probably is one but i can't find it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文