a-schild / nextcloud-java-api

Java api library to access nextcloud features from java applications
GNU General Public License v3.0
72 stars 50 forks source link

Apply expiration time for file share #44

Closed thegrimreapers95 closed 4 years ago

thegrimreapers95 commented 4 years ago

Expiration time does not apply HH: mm: ss

SharePermissions permissions = new SharePermissions(SharePermissions.SingleRight.READ); Share result_doShare = nextcloudConnector.doShare("/Musics/" + sysNotification.getFileName(), ShareType.PUBLIC_LINK, null, null, null, permissions); SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(System.currentTimeMillis()); Calendar c1 = Calendar.getInstance(); c1.setTime(date);

    c1.add(Calendar.MINUTE, 20);

    boolean result = nextcloudConnector.editShare(result_doShare.getId(), ShareData.EXPIREDATE, formatter.format(c1.getTime()));
a-schild commented 4 years ago

Does it give an error or what happens?

thegrimreapers95 commented 4 years ago

No errors occurred! But it does not accept HH: mm: ss

a-schild commented 4 years ago

When you look at the NextCloud GUI or the documentation https://docs.nextcloud.com/server/19/developer_manual/client_apis/OCS/ocs-share-api.html then you will see that it requires a date, with no time part.

So in short you can't define hours/minute/seconds when the share expires, but only a date