Use WebDAV to synchronize schedules from dominooa to exchange.

Source: Internet
Author: User
I. Function Description:

Add calendar in ekp's personal calendar to synchronize to exchange.

Exchange: Microsoft's mail server platform, used earlier to compete with Domino. Provides exchange workflows and multiple development interfaces, such as CdO and WebDAV.

Use Cases: the customer has or is more dependent on the use of exchange, from exchange to Domino OA platform.

Other functions can also be implemented: Mail, address book synchronization, and so on. You can use a similar function example.

Implementation Technical Instructions:

The extended protocol of WebDAV and http1.1 allows you to upload, query, and manage server files. Requests can be transmitted through file streams or XML files. Microsoft Exchange, including Sharepoint, applies this technology.

Ajax: X can be the custom XML, or the xml of the soap protocol in WebService. Of course, it can also be the XML definition of WebDAV. Therefore, at the UI Layer, Ajax is used to implement many unexpected functions, such as exchange integration and JS as the control bus, WS (such as the well-known Google map API) of multiple heterogeneous systems are called to create a hybrid mushup application. These applications are already very popular recently in web. In addition, make the corresponding webpart in SharePoint and directly read the list or WebService of the document library to implement a portal customization that can be dragged or dragged, or customize the webpart integrated with exchange, and so easy.

Problem: The time for appointment storage in exchange is world time, So I processed the time in XML in Js.

CodeExample:

Function getutcdatestr (date, time)
{
VaR dates = date. Split ("-");
VaR times = time. Split (":");
VaR utcdate = new date (dates [0], dates [1], dates [2], times [0], times [1], "00 ");
Utcstr = utcdate. getutcfullyear () + "-";
If (utcdate. getutcmonth () <10)
{
Utcstr + = "0" + utcdate. getutcmonth () + "-";
}
Else
{
Utcstr + = utcdate. getutcmonth () + "-";
}
If (utcdate. getutcdate () <10)
{
Utcstr + = "0" + utcdate. getutcdate () + "T ";
}
Else
{
Utcstr + = utcdate. getutcdate () + "T ";
}
If (utcdate. getutchours () <10)
{
Utcstr + = "0" + utcdate. getutchours () + ":";
}
Else
{
Utcstr + = utcdate. getutchours () + ":";
}
If (utcdate. getutcminutes () <10)
{
Utcstr + = "0" + utcdate. getutcminutes ();
}
Else
{
Utcstr + = utcdate. getutcminutes ();
}
// Utcstr = utcdate. getutcfullyear () + "-" + utcdate. getutcmonth () + "-" + utcdate. getutcdate () + "T" + utcdate. getutchours () + ":" + utcdate. getutcminutes ();
Return utcstr;
}
Function savetoexchange ()
{

VaR strxmlnsinfo = "xmlns: g = \" Dav :\""
+ "Xmlns: E = \" http://schemas.microsoft.com/exchange /\""
+ "Xmlns: mapi = \" http://schemas.microsoft.com/mapi /\""
+ "Xmlns: mapit = \" http://schemas.microsoft.com/mapi/proptag /\""
+ "Xmlns: x = \" XML: \ "xmlns: Cal = \" urn: schemas: calendar :\""
+ "Xmlns: dt = \" urn: UUID: c2f41010-65b3-11d1-a29f-00aa00c14882 /\""
+ "Xmlns: Header = \" urn: schemas: mailheader :\""
+ "Xmlns: Mail = \" urn: schemas: httpmail :\"";

VaR strcalinfo = "<CAL: Location>" + document. All. f_location.value + "</CAL: Location>"
+ "<CAL: dtstart DT: dt = \" datetime. TZ \ ">" + getutcdatestr (document. all. f_startdate.value, document. all. f_starttime.value) + ": 00.000z </CAL: dtstart>"
+ "<CAL: dtend DT: dt = \" datetime. TZ \ ">" + getutcdatestr (document. all. f_enddate.value, document. all. f_endtime.value) + ": 00.000z </CAL: dtend>"
+ "<CAL: instancetype DT: dt = \" int \ "> 0 </CAL: instancetype>"
+ "<CAL: busystatus> busy </CAL: busystatus>"
+ "<CAL: meetingstatus> confirmed </CAL: meetingstatus>"
+ "<CAL: alldayevent DT: dt = \" Boolean \ "> 0 </CAL: alldayevent>"
+ "<CAL: responserequested DT: dt = \" Boolean \ "> 1 </CAL: responserequested>"
+ "<CAL: reminderoffset DT: dt = \" int \ "> 900 </CAL: reminderoffset> ";

VaR strheaderinfo = "

// Set the subject of the appointment.
VaR strmailinfo = "<mail: Subject>" + document. All. Subject. Value + "</mail: Subject>"
+ "<Mail: htmldescription>" + document. All. Body. Value + "</mail: htmldescription> ";

VaR VXML = "<? XML version = \ "1.0 \"?> "
+ "<G: propertyupdate" + strxmlnsinfo + ">"
+ "<G: Set> <G: prop>"
+ "<G: contentclass> urn: Content-classes: appointment </G: contentclass>"
+ "<E: outlookmessageclass> IPM. Appointment </E: outlookmessageclass>"
+ Strmailinfo
+ Strcalinfo
+ Strheaderinfo
+ "<Mapi: finvited DT: dt = \" Boolean \ "> 1 </mapi: finvited>"
+ "</G: prop> </G: Set>"
+ "</G: propertyupdate> ";

VaR uri = "http: //" + exserver + "/exchange/" + exuser + "/calendar/" + docid + ". eml ";
VaR Req = new activexobject ("Microsoft. XMLHTTP ");

Req. Open ("proppatch", Uri, false, exuser, expassword );

Req. setRequestHeader ("Content-Type", "text/XML ");
Req. Send (VXML );

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.