msgraph-sdk-javascript icon indicating copy to clipboard operation
msgraph-sdk-javascript copied to clipboard

Creating a calendar event is giving error

Open changus opened this issue 7 years ago • 3 comments

Bug Report

Prerequisites

  • [x ] Can you reproduce the problem?
  • [ x] Are you running the latest version?
  • [x ] Are you reporting to the correct repository?
  • [ x] Did you perform a cursory search?

Steps to Reproduce

It's possible that this is an issue with the Microsoft Graph API itself, but when I am trying to post to a calendar with the code:

await client.api(/users/${userPrincipalName}/events) .header('content-type', 'application/json') .post({ event: event }) or client.api(/users/${userPrincipalName}/calendar/events)

I get the error The property 'event' does not exist on type 'Microsoft.OutlookServices.Event, which according to the documentation https://docs.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0 and https://docs.microsoft.com/en-us/graph/api/calendar-post-events?view=graph-rest-1.0, is what I should be posting to that endpoint. Any help would be appreciated. Thank you

changus avatar Aug 09 '19 01:08 changus

@andrueastman The sample may be wrong.

MIchaelMainer avatar Aug 22 '19 03:08 MIchaelMainer

@changus The parameter given in the post function is incorrect and the call should be as follows.

await client.api(/users/${userPrincipalName}/events)
.header('content-type', 'application/json')
.post( event );

@MIchaelMainer I will sort out the snippet generation for this asap.

andrueastman avatar Aug 22 '19 08:08 andrueastman

This issue has been resolved. Closing this issue, for now, feel free to open the issue if needed.

krototype avatar Sep 11 '19 09:09 krototype