Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JWebServices for Exchange
>
Tutorial
> Create folder path
The following example shows you how to create folder with subfolders.
import java.util.ArrayList; import java.util.List; import com.independentsoft.exchange.Folder; import com.independentsoft.exchange.FolderInfoResponse; import com.independentsoft.exchange.RequestServerVersion; import com.independentsoft.exchange.Service; import com.independentsoft.exchange.ServiceException; import com.independentsoft.exchange.StandardFolder; public class Example { public static void main(String[] args) { try { Service service = new Service("https://myserver/ews/Exchange.asmx", "username", "password"); //works on Exchange 2013 / Office365 and higher service.setRequestServerVersion(RequestServerVersion.EXCHANGE_2013); List
subfolders = new ArrayList
(); subfolders.add(new Folder("Folder1")); //Folder1 is under Inbox folder subfolders.add(new Folder("Folder2")); //Folder2 is under Folder1 subfolders.add(new Folder("Folder3")); //Folder3 is under Folder2 List
response = service.createFolderPath(subfolders, StandardFolder.INBOX); } catch (ServiceException e) { System.out.println(e.getMessage()); System.out.println(e.getXmlMessage()); e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*