Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't not fetchCalendarObjects from caldav.wecom.work #221

Open
quanru opened this issue Nov 12, 2024 · 1 comment
Open

can't not fetchCalendarObjects from caldav.wecom.work #221

quanru opened this issue Nov 12, 2024 · 1 comment

Comments

@quanru
Copy link

quanru commented Nov 12, 2024

import { createDAVClient } from 'tsdav';

(async () => {
  const client = await createDAVClient({
    serverUrl: 'https://caldav.wecom.work',
    credentials: {
      username: '[email protected]',
      password: 'FtBpSvuc69SYzgSB',
    },
    authMethod: 'Basic',
    defaultAccountType: 'caldav',
  });
  
  const calendars = await client.fetchCalendars();
  console.log('calendars: ', calendars);

  const calendar = calendars[0];

  const calendarObjects = await client.fetchCalendarObjects({
    calendar: calendar,
    expand: true,
  });

  console.log(JSON.stringify(calendarObjects, null, 2));
})().catch(error => {
  console.error('error:', error);
});

DEBUG=* node tsdav.mjs
Debugger attached.
  tsdav:authHelper Basic auth token generated: bGlueWliaW5nQGxpZmVvczEud2Vjb20ud29yazpGdEJwU3Z1YzY5U1l6Z1NC +0ms
  tsdav:account Service discovery... +0ms
  tsdav:account Service discovery redirected to https://caldav.wecom.work/calendar/ +587ms
  tsdav:account Fetching principal url from path https://caldav.wecom.work/calendar/ +1ms
  tsdav:account Fetched principal url /calendar/linyibing%40lifeos1.wecom.work +523ms
  tsdav:account Fetch home url from https://caldav.wecom.work/calendar/linyibing%40lifeos1.wecom.work +0ms
  tsdav:account Fetched home url https://caldav.wecom.work/calendar/ +480ms
calendars:  [
  {
    description: '[email protected]',
    timezone: 'BEGIN:VTIMEZONE\r\n' +
      'TZID:Asia/Shanghai\r\n' +
      'X-LIC-LOCATION:Asia/Shanghai\r\n' +
      'BEGIN:STANDARD\r\n' +
      'TZOFFSETFROM:+0800\r\n' +
      'TZOFFSETTO:+0800\r\n' +
      'TZNAME:CST\r\n' +
      'DTSTART:19700101T000000\r\n' +
      'END:STANDARD\r\n' +
      'END:VTIMEZONE',
    url: 'https://caldav.wecom.work/calendar/1688855375594291/',
    ctag: 1731112901,
    calendarColor: '#2d8eff',
    displayName: 'xxx',
    components: [ 'VEVENT' ],
    resourcetype: [ 'collection', 'calendar' ],
    syncToken: 'http://dav.exmail.qq.com/ns/sync-token/1731112901',
    projectedProps: {},
    reports: [ 'expandProperty', 'syncCollection' ]
  }
]
  tsdav:calendar Fetching calendar objects from https://caldav.wecom.work/calendar/1688855375594291/ +0ms
[
  {
    "url": "https://caldav.wecom.work/calendar/1688855375594291/",
    "etag": "[object Object]",
    "data": {}
  },
  {
    "url": "https://caldav.wecom.work/calendar/1688855375594291/f3a370bed921ec2bce27ca8111b25f15uprduwqs.ics",
    "etag": "1731113340",
    "data": {}
  }
]
@quanru
Copy link
Author

quanru commented Nov 13, 2024

I can manually download content of https://caldav.wecom.work/calendar/1688855375594291/f3a370bed921ec2bce27ca8111b25f15uprduwqs.ics:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Tencent Inc.//QQMail//CalDAV v1.0//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:TZ08
BEGIN:STANDARD
DTSTART:19700101T000000
TZOFFSETFROM:+0800
TZOFFSETTO:+0800
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:f3a370bed921ec2bce27ca8111b25f15uprduwqs
DTSTAMP:20241109T084900
CREATED:20241109T084141
SEQUENCE:4723483
DTSTART;TZID=TZ08:20241109T090000
DTEND;TZID=TZ08:20241109T100000
SUMMARY:企业微信日历调试
ORGANIZER;CN="林宜丙":mailto:[email protected]
TRANSP:OPAQUE
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant