After 6 hours of searching the internet. I found a website with a php script that could generate for example emails:
http://www.troywolf.com/articles/php...v_examples.php
I modified the script and now it can add appointments. Here's the code:
Code:
<?php
// Modify the path to this class file as needed.
require_once("class_http.php");
// Change these values for your Exchange Server.
$exchange_server = "http://192.168.0.40";
$exchange_username = "test";
$exchange_password = "123!test";
// We use Troy's http class object to send the XML-formatted WebDAV request
// to the Exchange Server and to receive the response from the Exchange Server.
// The response is also XML-formatted.
$h = new http();
$h->headers["Content-Type"] = 'text/xml; charset="UTF-8"';
$h->headers["Depth"] = "0";
$h->headers["Translate"] = "f";
$subject = "a" . rand();
// Build the XML request.
// This section must be against the left margin.
$h->xmlrequest = '<?xml version="1.0" encoding="utf-8"?>';
$h->xmlrequest .= <<<END
<D:propertyupdate xmlns:ns0="http://schemas.microsoft.com/exchange/"
xmlns:ns1="http://schemas.microsoft.com/mapi/"
xmlns:ns2="http://schemas.microsoft.com/mapi/proptag/"
xmlns:ns3="urn:schemas:calendar:" xmlns:D="DAV:">
<D:set>
<D:prop>
<ns0:outlookmessageclass>IPM.Appointment</ns0:outlookmessageclass>
<ns1:subject>My New Appointment</ns1:subject>
<ns2:x1000001e>Test</ns2:x1000001e>
<ns3:dtend>2008-10-28T09:55:18.142Z</ns3:dtend>
<ns3:dtstart>2008-10-26T07:55:17.909Z</ns3:dtstart>
</D:prop>
</D:set>
</D:propertyupdate>
END;
// IMPORTANT -- The END line above must be completely left-aligned. No white-space.
// The http object's 'fetch' method does the work of sending and receiving the
// request. We use the WebDAV PROPPATCH method to create or update Exchange items.
$url = $exchange_server."/Exchange/test/calendar/".urlencode($subject).".EML";
if (!$h->fetch($url, 0, null, $exchange_username, $exchange_password, "PROPPATCH")) {
echo "<h2>There is a problem with the http request!</h2>";
echo $h->log;
exit();
}
// You can print out the response to help troubleshoot.
echo "<pre>".$h->header."</pre><hr />\n";
echo "<pre>".$h->body."</pre><hr />\n";
// Bonus tip! You can automatically open this new draft message for your user by
// formulating an outlook URL. Then either redirect to the URL by uncommenting the
// header line below, or pop the URL in client-side javascript using window.open.
#header("Location: outlook:drafts/~".urlencode($subject));
?>