. . .

JAVA example

In the example below the assertThat method of hamcrest is used in a junit test to assert that the loaded list is not empty.

The example authenticates towards the ApiOmat with the Sharepoint credentials that were saved in customerMail and customerPwd and loads the list of items found at the configured path. The path will have been configured in ApiOmat at the time of Sharepoint module setup and can be accessed in the module config.

The blank List checkList will be filled through the function getSharepointLists() and can then be checked for items. Each loaded item can be accessed in the list and can be modified and saved through its corresponding methods. For example setTitle("new Title") and save().

public void getSharepointList( )
// authorize with Sharepoint credentials
Datastore.configureWithCredentials( User.baseURL, User.apiKey, this.customerMail,
this.customerPwd, User.sdkVersion, User.system );
List<SharepointList> checkList = new ArrayList<SharepointList>( );
// load all items of the configured Sharepoint path
checkList = SharepointList.getSharepointLists( "" );
catch ( ApiomatRequestException e )
this.savedError = e;
assertThat( false, equalTo( checkList.isEmpty( ) ) );