console.log(`ownerUser: "${ownerUser}", timeFrom: "${timeFrom}", ` +
`timeTo: "${timeTo}", title: "${title}", description: "${description}", ` +
`calendarId: "${calendarId}"`);
const ownerUserId = getUserId(ownerUser);
bx24.callMethod('calendar.section.get',
{
type: "user"
}
);
const eventId = bx24.callMethod("calendar.event.add",
{
type: 'user',
ownerId: ownerUserId,
name: title,
description: description,
from: timeFrom,
to: timeTo,
section: calendarId,
color: '#9cbe1c',
text_color: '#283033',
accessibility: 'absent',
importance: 'normal',
is_meeting: 'N',
private_event: 'N',
remind: [{type: 'min', count: 20}],
}
);
return {
"eventId": eventId
};
function getUserId(user) {
if (user.startsWith("user_")) {
user = user.substring(5);
}
return parseInt(user);
}