Javascript 如何使用节点ews集成Exchange 2010版本的投票选项?

Javascript 如何使用节点ews集成Exchange 2010版本的投票选项?,javascript,node.js,soap,exchangewebservices,Javascript,Node.js,Soap,Exchangewebservices,我无法在发送电子邮件时创建投票选项,我已通过ExtendedProperty尽了最大努力,但运气不佳无法实现。我是node js的初学者,任何帮助/建议/指导都是值得的 const EWS = require('node-ews'); const NTLMAuth = require('httpntlm').ntlm; const passwordPlainText = 'ABCDFGH'; // store the ntHashedPassword and lmHashedPassw

我无法在发送电子邮件时创建投票选项,我已通过ExtendedProperty尽了最大努力,但运气不佳无法实现。我是node js的初学者,任何帮助/建议/指导都是值得的

    const EWS = require('node-ews');
const NTLMAuth = require('httpntlm').ntlm;
const passwordPlainText = 'ABCDFGH';

// store the ntHashedPassword and lmHashedPassword to reuse later for reconnecting
const ntHashedPassword = NTLMAuth.create_NT_hashed_password(passwordPlainText);
const lmHashedPassword = NTLMAuth.create_LM_hashed_password(passwordPlainText);

// exchange server connection info
const ewsConfig = {
username: 'kiranraj.@demo.com',
nt_password: ntHashedPassword,
lm_password: lmHashedPassword,
host: 'https://mail.yyy.xxxx.com/'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

const ewsFunction = 'CreateItem';

// define ews api function args
const ewsArgs = {
"attributes" : {
"MessageDisposition" : "SendAndSaveCopy"
},
"SavedItemFolderId": {
"DistinguishedFolderId": {
"attributes": {
"Id": "sentitems"
}
}
},
"Items" : {
"Message" : {
"ItemClass": "IPM.Note",
"Subject" : "Test EWS Email",
"Body" : {
"attributes": {
"BodyType" : "HTML"
},
"$value": "This is a test email"
},
"ExtendedProperty" : {
"ExtendedFieldURI" : {
"attributes" : {
"DistinguishedPropertySetId" : "InternetHeaders",
//"PropertySetId" : "00062008-0000-0000-C000-000000000046",
//"PropertyTag" : "0x8520",
"PropertyName" : "0x8520",
//"PropertyId" : "",
"PropertyType" : "String"
}
}
,"Value" : "Omg!appeared"
},
"ToRecipients" : {
"Mailbox" : [
//{ "EmailAddress" : "kiranraj.p@demo.com" }
{ "EmailAddress" : "lokendranath.v@demo.com" }
]
},
"IsRead": "false"
}
}
};

// define custom soap header
const ewsSoapHeader = {
't:RequestServerVersion': {
attributes: {
Version: "Exchange2010"
}
}
};

// query ews, print resulting JSON to console
ews.run(ewsFunction, ewsArgs, ewsSoapHeader)
.then(result => {
console.log(JSON.stringify(result));
console.log(JSON.stringify(ewsArgs))
})
.catch(err => {
console.log(err.stack);
});

console.log(ews)   
基于上述代码,我可以发送邮件,但投票选项在发送的邮件中不可见

{"ResponseMessages":{"CreateItemResponseMessage":{"attributes":{"ResponseClass":"Success"},"ResponseCode":"NoError","Items":null}}} {"attributes":{"MessageDisposition":"SendAndSaveCopy"},"SavedItemFolderId":{"DistinguishedFolderId":{"attributes":{"Id":"sentitems"}}},"Items":{"Message":{"ItemClass":"IPM.Note","Subject":"Test EWS Email","Body":{"attributes":{"BodyType":"HTML"},"$value":"<b>This is a test email</b>"},"ExtendedProperty":{"ExtendedFieldURI":{"attributes":{"DistinguishedPropertySetId":"InternetHeaders","PropertyName":"0x8520","PropertyType":"String"}},"Value":"Omg!appeared"},"ToRecipients":{"Mailbox":[{"EmailAddress":"lokendranath.v@demo.com"}]},"IsRead":"false"}}}    
{“ResponseMessages”:{“CreateItemResponseMessage”:{“属性”:{“ResponseClass”:“Success”},“ResponseCode”:“NoError”、“Items”:null}}}}{“attributes”:{“MessageDisposition”:“SendAndSaveCopy”},“SavedItemFolderId”:{“DifferentiedFolderId”:{“attributes”:{“Id”:“Senitems”}}},“Items”:{“Message:{“attributes”:{“BodyType”:“HTML”},$value”:“这是一封测试电子邮件”},“ExtendedProperty”:{“ExtendedFieldURI”:{“attributes”:{“distrizedpropertysetid”:“InternetHeaders”,“PropertyName”:“0x8520”,“PropertyType”:“String”},“value”:“Omg!出现”},“ToRecipients”:{“邮箱”[{“EmailAddress”:“lokendranath”。v@demo.com“}]},IsRead:“false”}}
这是来自SOAPUI的Soap测试请求:-

    <?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
      xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010" />
  </soap:Header>
  <soap:Body>
    <m:CreateItem MessageDisposition="SendAndSaveCopy">
      <m:SavedItemFolderId>
        <t:DistinguishedFolderId Id="sentitems" />
      </m:SavedItemFolderId>
      <m:Items>
        <t:Message>
          <t:Subject>Saved with extendedPropertyDefinition of two days</t:Subject>
          <t:Body BodyType="Text">The expiration date is contained within the extended property.</t:Body>
        <t:ExtendedProperty>
        <t:ExtendedFieldURI PropertySetId ="Common" PropertyName="PSETID_Common" PropertyId="0x8520"  PropertyType="PT_BINARY"></t:ExtendedFieldURI>
        <t:Value>Approve</t:Value>
        </t:ExtendedProperty>
        <t:ExtendedProperty>
        <t:ExtendedFieldURI PropertySetId ="Common" PropertyName="PSETID_Common" PropertyId="0x8520"  PropertyType="PT_BINARY"></t:ExtendedFieldURI>
        <t:Value>Decline</t:Value>
        </t:ExtendedProperty>
          <t:ToRecipients>
            <t:Mailbox>
              <t:EmailAddress>kiranraj.p@demo.com</t:EmailAddress>
            </t:Mailbox>
          </t:ToRecipients>
        </t:Message>
      </m:Items>
    </m:CreateItem>
  </soap:Body>
</soap:Envelope>
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation</faultcode>
         <faultstring xml:lang="en-US">The request failed schema validation: The 'PropertySetId' attribute is invalid - The value 'Common' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:GuidType' - The Pattern constraint failed.</faultstring>
         <detail>
            <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode>
            <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.</e:Message>
            <t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
               <t:LineNumber>19</t:LineNumber>
               <t:LinePosition>23</t:LinePosition>
               <t:Violation>The 'PropertySetId' attribute is invalid - The value 'Common' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:GuidType' - The Pattern constraint failed.</t:Violation>
            </t:MessageXml>
         </detail>
      </s:Fault>
   </s:Body>
</s:Envelope>

使用extendedPropertyDefinition保存两天
过期日期包含在扩展属性中。
批准
减少
基兰拉吉。p@demo.com
返回以下响应:-

    <?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
      xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010" />
  </soap:Header>
  <soap:Body>
    <m:CreateItem MessageDisposition="SendAndSaveCopy">
      <m:SavedItemFolderId>
        <t:DistinguishedFolderId Id="sentitems" />
      </m:SavedItemFolderId>
      <m:Items>
        <t:Message>
          <t:Subject>Saved with extendedPropertyDefinition of two days</t:Subject>
          <t:Body BodyType="Text">The expiration date is contained within the extended property.</t:Body>
        <t:ExtendedProperty>
        <t:ExtendedFieldURI PropertySetId ="Common" PropertyName="PSETID_Common" PropertyId="0x8520"  PropertyType="PT_BINARY"></t:ExtendedFieldURI>
        <t:Value>Approve</t:Value>
        </t:ExtendedProperty>
        <t:ExtendedProperty>
        <t:ExtendedFieldURI PropertySetId ="Common" PropertyName="PSETID_Common" PropertyId="0x8520"  PropertyType="PT_BINARY"></t:ExtendedFieldURI>
        <t:Value>Decline</t:Value>
        </t:ExtendedProperty>
          <t:ToRecipients>
            <t:Mailbox>
              <t:EmailAddress>kiranraj.p@demo.com</t:EmailAddress>
            </t:Mailbox>
          </t:ToRecipients>
        </t:Message>
      </m:Items>
    </m:CreateItem>
  </soap:Body>
</soap:Envelope>
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation</faultcode>
         <faultstring xml:lang="en-US">The request failed schema validation: The 'PropertySetId' attribute is invalid - The value 'Common' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:GuidType' - The Pattern constraint failed.</faultstring>
         <detail>
            <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode>
            <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.</e:Message>
            <t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
               <t:LineNumber>19</t:LineNumber>
               <t:LinePosition>23</t:LinePosition>
               <t:Violation>The 'PropertySetId' attribute is invalid - The value 'Common' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:GuidType' - The Pattern constraint failed.</t:Violation>
            </t:MessageXml>
         </detail>
      </s:Fault>
   </s:Body>
</s:Envelope>

a:保价
请求架构验证失败:“PropertySetId”属性无效-根据其数据类型,“Common”值无效http://schemas.microsoft.com/exchange/services/2006/types:GuidType“-模式约束失败。
误投
请求未通过架构验证。
19
23
“PropertySetId”属性无效-值“Common”根据其数据类型无效”http://schemas.microsoft.com/exchange/services/2006/types:GuidType“-模式约束失败。

下面是设置PidLidVerbStream属性的示例,请注意,此属性是一个复杂的二进制流,在


测试邮件
测试
AgehaaaaaaaaaaaaavszbSeqhjue0UTM90ZQDnzaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazgjcgjcgxx5hjjjjjjjgx5hjjjjjjjjjjjjjjjjjgjjjjjjjgqqqqqqqqqqqqqqqqqaaaaaaaaaaaaaaaaaaWvzcelqts5ob3rlaaanzxmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaap///8eaaaabu1jlqts5ob3rlavnyxlizaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaap///8eaaaaaaaaaabu1jlqts5ob3rlavnyxlixlizqlavnyxlizqaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaMAAK4ABWACTGBVAAVNAGEQBIAGUABU0AYQB5AGIAZQA=
gscales@datarumble.com

您的代码没有显示任何设置PidLidVerbStream的尝试,这是您在ewsThank@GlenScales中使投票按钮工作的唯一方法,这里我使用节点ews库通过SOAP请求发送邮件,您知道有什么方法在SOAP请求中提及此PidLidVerbStream吗?您的请求无效,请参阅我在下面发布的XML,这可能会使你的生活更容易使用,而不是使用你尝试的库。这可能会在这方面有所帮助。非常感谢,你是如何转换t:ExtendedFieldURI的值的?。也让我知道如何解码和做必要的更改,如设置自定义选项。你能描述一下,如何编码这种格式的值一步一步请。它只是base64编码的属性格式记录在我发布的链接。这是一种复杂的格式