Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JWebDAV for Exchange
>
Tutorial
> Create journal
The following example shows you how to create journal. Journal will be saved in Journal folder
import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import com.independentsoft.webdav.exchange.Journal; import com.independentsoft.webdav.exchange.MultiStatus; import com.independentsoft.webdav.exchange.WebdavClient; import com.independentsoft.webdav.exchange.WebdavException; public class Example { public static void main(final String[] args) { try { WebdavClient client = new WebdavClient("https://myserver/exchange/emailaddress", "username", "password"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startDate = dateFormat.parse("2024-01-30 16:00:00"); Date endDate = dateFormat.parse("2024-01-30 16:15:00"); Journal journal1 = new Journal(); journal1.setSubject("journal1"); journal1.setBody("Body text."); journal1.setStartDate(startDate); journal1.setEndDate(endDate); journal1.setEntry("Phone Call"); journal1.setType("Phone Call"); MultiStatus multiStatus = client.createItem(journal1); String journalUrl = multiStatus.getResponses()[0].getHRef(); System.out.println("Url of just created journal = " + journalUrl); } catch (WebdavException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } } }