Closed dlemper closed 7 years ago
https://msdn.microsoft.com/en-us/library/office/dn720424(v=exchg.150).aspx It works for me. Can you provide an example of the request you are making and the exact error message you are receiving?
I wrote copied this code together:
const EWS = require('node-ews');
// exchange server connection info
let ewsConfig = {
username: 'demo',
password: 'test',
host: 'https://exchange.example.org'
};
// initialize node-ews
let ews = new EWS(ewsConfig);
// define ews api function
let ewsFunction = 'GetReminders';
// define ews api function args
let ewsArgs = {
EndTime: '2017-10-25T00:00:00Z',
ReminderType: 'ALL',
};
const ewsSoapHeader = {
't:RequestServerVersion': {
attributes: {
Version: "Exchange2013"
}
}
};
// query EWS and print resulting JSON to console
ews.run(ewsFunction, ewsArgs, ewsSoapHeader)
.then(result => {
console.log(JSON.stringify(result));
})
.catch(err => {
console.log(err.message);
});
and the result by running this code:
$ node index.js
ewsFunction not found in WSDL: GetReminders
Using the Outlook Web App I can see a GetReminders request in my browser, that works.
You are quite right! It would appear that the WSDL from my Exchange 2013 server does not include the GetReminders operation either, even though the server actually supports it. I'm using a manually modified WSDL in my node-ews project which is why it worked for me and is likely what you will need to do as well.
I couldn't find an already edited WSDL but the attached services.zip is the one I'm using (there are of course no guarantees so use it at your own risk). If you would however prefer to use your existing WSDL and manually edit it then using https://msdn.microsoft.com/en-us/library/mt742998(v=exchg.80).aspx you should be able to figure it out, but my instructions are as follows:
1. Find '</wsdl:portType>' and paste the following code before it:
<!-- GetReminders -->
<wsdl:operation name="GetReminders">
<wsdl:input message="tns:GetRemindersSoapIn" />
<wsdl:output message="tns:GetRemindersSoapOut" />
</wsdl:operation>
2. Find the '</wsdl:binding>' and paste the following code before it:
<!-- GetReminders -->
<wsdl:operation name="GetReminders">
<soap:operation soapAction="http://schemas.microsoft.com/exchange/services/2006/messages/GetReminders"/>
<wsdl:input>
<soap:header message="tns:GetRemindersSoapIn" part="RequestVersion" use="literal"/>
<soap:body parts="request" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body parts="GetRemindersResult" use="literal"/>
<soap:header message="tns:GetRemindersSoapOut" part="ServerVersion" use="literal"/>
</wsdl:output>
</wsdl:operation>
3. Find the '
<!-- GetReminders -->
<wsdl:message name="GetRemindersSoapIn">
<wsdl:part name="request" element="tns:GetReminders"/>
<wsdl:part name="RequestVersion" element="t:RequestServerVersion"/>
</wsdl:message>
<wsdl:message name="GetRemindersSoapOut">
<wsdl:part name="GetRemindersResult" element="tns:GetRemindersResponse"/>
<wsdl:part name="ServerVersion" element="t:ServerVersionInfo"/>
</wsdl:message>
4. Save the updated WSDL file.
If you have access to your EWS server then you can edit the services.wsdl and you're good, but if not then you can override the node-ews temporary directory and put your custom WSDL file there.
For example, create a folder in your node application called "WSDL" then in your script add temp:__dirname+'\\WSDL'
to your ewsConfig to override the node-ews temporary directory like:
// exchange server connection info
let ewsConfig = {
username: 'demo',
password: 'test',
host: 'https://exchange.example.org',
temp:__dirname+'\\WSDL'
};
Then execute your script. This should then download a copy of the services, messages, and types definition files. Now you can either replace the downloaded copy with mine or make the manual adjustments outlined above then retry your script again and all should be well.
Hope this helps and please let me know how it goes!
ok, that looks quite good, as the GetReminder function is defined. however I get the following error:
$ node .
a:ErrorSchemaValidation: The request failed schema validation: The 'http://schemas.microsoft.com/exchange/services/2006/messages:ReminderType' element is invalid - The value 'ALL' is invalid according to its datatype 'String' - The Enumeration constraint failed.
It seems like I have to define the ReminderType in types.xsd... Do you have the required lines handy?
OK, seems I already have the ReminderType defined, but my code (which didn't change besides of the temp field in config) has wrong ewsArgs.. Do you have any suggestions for me on how to change this?
Ah yes. If you look at the ReminderType definition it is actually looking for 3 very specific values and they are case sensitive. So your "ALL" needs to be "All".
Oh, thank you, now it works!
No problem!
Hi,
I just wanted to execute the GetReminders function of Exchange 2013, but this function is not valid as node-ews tells me. However, I can see that our OWA executes this function. I already looked into the services.wsdl and messages.xsd files and GetReminders is only in the messages.xsd and not in services.wsdl.
Is there any way I can get the function executed? Thank you in advance!