Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JShare
>
Tutorial
> Create list
The following example shows you how to create a list.
import com.independentsoft.share.List; import com.independentsoft.share.ListTemplateType; import com.independentsoft.share.Service; import com.independentsoft.share.ServiceException; import com.independentsoft.share.Site; import com.independentsoft.share.SiteCreationInfo; public class Example { public static void main(String[] args) { try { Service service = new Service("https://independentsoft.sharepoint.com", "username", "password"); List list = new List(); list.setTitle("Test"); list.setBaseTemplate(ListTemplateType.GENERIC_LIST); list.setContentTypesEnabled(true); list.setDescription("My list description"); List createdList = service.createList(list); System.out.println("Id: " + createdList.getId()); System.out.println("EntityTypeName: " + createdList.getEntityTypeName()); System.out.println("ListItemEntityTypeFullName: " + createdList.getListItemEntityTypeFullName()); } catch (ServiceException ex) { System.out.println("Error: " + ex.getMessage()); System.out.println("Error: " + ex.getErrorCode()); System.out.println("Error: " + ex.getErrorString()); System.out.println("Error: " + ex.getRequestUrl()); ex.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*