Create a Teams calendar event from a bot

%3CLINGO-SUB%20id%3D%22lingo-sub-1304807%22%20slang%3D%22en-US%22%3ECreate%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1304807%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20have%20a%20nodejs%20bot%20running%20with%20my%20Teams%20app.%20I%20would%20link%20to%20add%20a%20new%20meeting%20event%20in%20Teams%20calendar%2C%20is%20it%20possible%3F%20I%20have%20read%20about%20'schedules'%20in%20Graph%20API%2C%20but%20I%20am%20not%20sure%20if%20this%20is%20the%20key%2C%20since%20I%20can%20not%20see%20fields%20like%20startTime%2C%20duration%2C%20...%3C%2FP%3E%3CP%3ECould%20you%20please%20help%20me%3F%3C%2FP%3E%3CP%3EThanks%20in%20advance%2C%3C%2FP%3E%3CP%3EDiego%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1304807%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1304906%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1304906%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F402611%22%20target%3D%22_blank%22%3E%40diegoSpace%3C%2FA%3E%26nbsp%3B-%20Could%20you%20please%20try%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fuser-post-events%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EGraph%20API%3C%2FA%3E%20to%20create%20calendar%20event.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1305123%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1305123%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F590590%22%20target%3D%22_blank%22%3E%40Nikitha-MSFT%3C%2FA%3E%26nbsp%3BThanks%20for%20your%20response.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20some%20doubts%2C%20please%20correct%20what%20I%20write%20below%20if%20required%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20far%20as%20I%20understand%2C%20I%20can%20use%20Application%20permission%20to%20create%20an%20event%2C%20so%20I%20will%20access%20Graph%20without%20a%20user%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fauth-v2-service%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fauth-v2-service%3C%2FA%3E)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20will%20use%20'POST%20%2Fusers%2F%7Bid%7D%2Fevents'%2C%20where%20the%20%7Bid%7D%20must%20be%20Teams%20userId%20(what%20I%20get%20in%20'activity.from.id'%20of%20an%20incoming%20command)%2C%20and%20not%20the%20Office365%2FAzure%20id.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E'Bearer'%20header%20is%20required%2C%20so%20I%20need%20a%20token.%20I%20have%20running%20code%20to%20get%20Teams%20users%2C%20and%20previously%20I%20get%20a%20bearer%20token%20with%20this%20options%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Evar%20options%20%3D%20%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20uri%3A%20'%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%7Btenant%3C%2FA%3E%20ID%7D%2Foauth2%2Fv2.0%2Ftoken'%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20method%3A%20'POST'%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20headers%3A%20%7B%20'Content-Type'%3A%20'application%2Fx-www-form-urlencoded'%20%7D%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20body%3A%20'client_id%3D'%20%2B%20%7BappId%7D%20%2B%20'%26amp%3Bclient_secret%3D'%20%2B%20%7BappPassword%7D%20%2B%20'%26amp%3Bscope%3Dhttps%253A%252F%252Fgraph.microsoft.com%252F.default%26amp%3Bgrant_type%3Dclient_credentials'%2C%3CBR%20%2F%3E%7D%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20the%20token%20received%20in%20the%20response%2C%20I%20can%20access%20to%20the%20users%20in%20a%20Teams%20group%3A%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%7BgroupID%7D%2Fmembers%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%7BgroupID%7D%2Fmembers%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20I%20use%20this%20token%20(for%20my%20application)%20to%20create%20an%20event%20for%20a%20user%20from%20the%20bot%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20a%20userId%20%3D%20'29%3A184h5dKIrOfsVklZrZyWMe91Gio.....nNQiCqFNLreLIEq-YC'%20I%20have%20tried%20this%20PUT%3A%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2F%7BuserId%7D%2Fcalendar%2Fevents%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2F%7BuserId%7D%2Fcalendar%2Fevents%3C%2FA%3E%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20and%20the%20previous%20Authentication%20bearer%20token%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20with%20an%20example%20event%20as%20body%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ebut%20I%20get%20a%20'500%20Internal%20Server%20Error'%20as%20response.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20am%20I%20doing%20wrong%3F%3C%2FP%3E%3CP%3EThanks%20a%20lot%2C%3C%2FP%3E%3CP%3EDiego%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1305564%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1305564%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F402611%22%20target%3D%22_blank%22%3E%40diegoSpace%3C%2FA%3E%26nbsp%3B-%20%7Bid%7D%20should%20be%20user%20azure%20id%20or%20UPN.%20Could%20you%20please%20try%20using%20the%20azure%20id%20or%20UPN.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1305992%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1305992%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F590590%22%20target%3D%22_blank%22%3E%40Nikitha-MSFT%3C%2FA%3E%26nbsp%3BThanks%2C%20Using%20the%20Azure%20id%20i%20get%20this%20error%20response%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%22code%22%3A%20%22ErrorInvalidRequest%22%2C%3CBR%20%2F%3E%22message%22%3A%20%22The%20OData%20request%20is%20not%20supported.%22%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1308291%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1308291%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F402611%22%20target%3D%22_blank%22%3E%40diegoSpace%3C%2FA%3E%26nbsp%3B-%20Could%20you%20please%20share%20your%20request%20body%20what%20you%20are%20trying%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1308319%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1308319%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F590590%22%20target%3D%22_blank%22%3E%40Nikitha-MSFT%3C%2FA%3E%26nbsp%3BI%20used%20the%20example%20body%20from%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fuser-post-events%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fuser-post-events%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(updated%20date%20%26amp%3B%20timezone)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22subject%22%3A%20%22Let's%20go%20for%20lunch%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22body%22%3A%20%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22contentType%22%3A%20%22HTML%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22content%22%3A%20%22Does%20late%20morning%20work%20for%20you%3F%22%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7D%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22start%22%3A%20%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22dateTime%22%3A%20%222020-04-15T12%3A00%3A00%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22timeZone%22%3A%20%22Europe%2FMadrid%22%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7D%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22end%22%3A%20%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22dateTime%22%3A%20%222020-04-15T14%3A00%3A00%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22timeZone%22%3A%20%22Europe%2FMadrid%22%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7D%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22location%22%3A%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22displayName%22%3A%22Harry's%20Bar%22%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7D%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22attendees%22%3A%20%5B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22emailAddress%22%3A%20%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22address%22%3A%22samanthab%40contoso.onmicrosoft.com%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22name%22%3A%20%22Samantha%20Booth%22%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7D%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22type%22%3A%20%22required%22%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%7D%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%5D%3CBR%20%2F%3E%7D%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1309338%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1309338%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F402611%22%20target%3D%22_blank%22%3E%40diegoSpace%3C%2FA%3E%26nbsp%3B%2C%20Do%20you%20have%20required%20Calendar.ReadWrite%20permission%20in%20your%20access%20token%3F%20You%20can%20check%20that%20on%20%3CA%20href%3D%22http%3A%2F%2Fjwt.io%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ejwt.io.%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1309454%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1309454%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F371090%22%20target%3D%22_blank%22%3E%40Trinetra-MSFT%3C%2FA%3E%26nbsp%3BThanks%20for%20your%20response%2C%20on%20jwt.io%20I%20could%20see%20my%20permissions%2C%20and%20there%20was%20no%20permission%20for%20Calendar.%20I%20added%20it%20in%20my%20app%20(Azure)%20and%20then%20retried%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%22roles%22%3A%20%5B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%22User.ReadWrite.All%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%22Group.Read.All%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%22Directory.ReadWrite.All%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%22Directory.Read.All%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%22User.Read.All%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%22GroupMember.Read.All%22%2C%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%22Calendars.ReadWrite%22%3CBR%20%2F%3E%5D%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20with%20that%20token%20I%20still%20have%20the%20error%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22The%20OData%20request%20is%20not%20supported.%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20%22Calendars.ReadWrite%22%20permission%20the%20only%20required%3F%20It%20is%20without%20'.All'%20(like%20the%20others)%2C%20I%20have%20not%20found%20the%20'.All'%20one...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20raw%20request%20is%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPUT%20%2Fv1.0%2Fusers%2Fbcb3f5a......23a5925%2Fcalendar%2Fevents%20HTTP%2F1.1%3CBR%20%2F%3EAuthorization%3A%20Bearer%20eyJ0eXAiOiJKV1Q.....EUquw%3CBR%20%2F%3EHost%3A%20graph.microsoft.com%3CBR%20%2F%3EContent-Type%3A%20application%2Fjson%3CBR%20%2F%3EContent-Length%3A%20548%3C%2FP%3E%3CP%3E%7B%3CBR%20%2F%3E%22subject%22%3A%20%22Let's%20go%20for%20lunch%22%2C%3CBR%20%2F%3E%22body%22%3A%20%7B%3CBR%20%2F%3E%22contentType%22%3A%20%22HTML%22%2C%3CBR%20%2F%3E%22content%22%3A%20%22Does%20late%20morning%20work%20for%20you%3F%22%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22start%22%3A%20%7B%3CBR%20%2F%3E%22dateTime%22%3A%20%222020-04-15T12%3A00%3A00%22%2C%3CBR%20%2F%3E%22timeZone%22%3A%20%22Europe%2FMadrid%22%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22end%22%3A%20%7B%3CBR%20%2F%3E%22dateTime%22%3A%20%222020-04-15T14%3A00%3A00%22%2C%3CBR%20%2F%3E%22timeZone%22%3A%20%22Europe%2FMadrid%22%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22location%22%3A%7B%3CBR%20%2F%3E%22displayName%22%3A%22Harry's%20Bar%22%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22attendees%22%3A%20%5B%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%22emailAddress%22%3A%20%7B%3CBR%20%2F%3E%22address%22%3A%22samanthab%40contoso.onmicrosoft.com%22%2C%3CBR%20%2F%3E%22name%22%3A%20%22Samantha%20Booth%22%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22type%22%3A%20%22required%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%5D%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks%20a%20lot%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EDiego%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1311633%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1311633%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F402611%22%20target%3D%22_blank%22%3E%40diegoSpace%3C%2FA%3E%26nbsp%3B%2C%20I%20see%20you%20are%20hitting%20the%20Put%20request%20%2C%20Ideally%20it%20should%20be%20POST%3A%3C%2FP%3E%0A%3CP%3EPOST%26nbsp%3B%3CSPAN%3E%3CA%20href%3D%22http%3A%2F%2F%2520%2Fv1.0%2Fusers%2F%7BUPN%7D%2Fcalendar%2Fevents%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%2Fv1.0%2Fusers%2F%7BUserPrincipleName%7D%2Fcalendar%2Fevents%3C%2FA%3E.%20Try%20with%20this%20and%20let%20me%20know%2C%20how%20it%20goes%2C%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EPlease%20take%20a%20look%20at%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fuser-post-events%3Fview%3Dgraph-rest-beta%26amp%3Btabs%3Dhttp%23example-5-create-and-enable-an-event-as-an-online-meeting%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EExample%205%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1312343%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1312343%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F371090%22%20target%3D%22_blank%22%3E%40Trinetra-MSFT%3C%2FA%3E%26nbsp%3BThanks%20for%20your%20response%2C%20that%20was%20the%20problem.%20I%20don't%20know%20why%20i%20was%20using%20PUT%20(i%20think%20I%20see%20it%20somewhere)%2C%20but%20event%20documentation%20says%20clearly%20'POST'.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBy%20the%20way%2C%20which%20version%20of%20Graph%20API%20should%20I%20used%3F%201.0%20or%20beta%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20a%20lot!%3C%2FP%3E%3CP%3EDiego%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1314956%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1314956%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F402611%22%20target%3D%22_blank%22%3E%40diegoSpace%3C%2FA%3E%26nbsp%3B%2C%20If%20you%20are%20looking%20to%20Create%20a%20Event%20in%20user%20calendar%20you%20can%20use%20v1.0%20but%20if%20you%20want%20to%20get%20the%20joinWebUrl%20too%20than%20go%20for%20beta%20version.%20create%20event%20with%20online%20meeting%20provider%20api%20is%20in%20beta%20version.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1315006%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1315006%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F402611%22%20target%3D%22_blank%22%3E%40diegoSpace%3C%2FA%3E%26nbsp%3B-%20Teams%20support%20both%20v1.0%20and%20beta%20version%20to%20create%20event.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1322210%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1322210%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F371090%22%20target%3D%22_blank%22%3E%40Trinetra-MSFT%3C%2FA%3E%26nbsp%3BThanks.%20Is%20it%20possible%20to%20open%20Teams%20Calendar%20view%20programatically%20(or%20even%20recently%20created%20event)%20once%20I%20receive%20the%20event%20creation%20response%3F%20My%20Teams%20event%20is%20created%20from%20a%20Messaging%20extension%20dialog%2C%20and%20I%20would%20like%20to%20open%20it%20once%20created%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1323469%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1323469%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F402611%22%20target%3D%22_blank%22%3E%40diegoSpace%3C%2FA%3E%26nbsp%3B%2C%20I've%20not%20seen%20this%20but%20I%20assume%20that%20you%20can%20try%20to%20deep%20link%20the%20webLink%20Url%20with%20Teams%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1323653%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1323653%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F371090%22%20target%3D%22_blank%22%3E%40Trinetra-MSFT%3C%2FA%3E%26nbsp%3BIf%20I%20use%20microsoftTeams.executeDeepLink(webLink)%20in%20my%20Teams%20task%20the%20created%20event%20is%20open%20but%20in%20a%20browser%20(not%20in%20Teams%20client%20I%20mean)%3A%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Foutlook.office365.com%2Fcalendar%2Fitem%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office365.com%2Fcalendar%2Fitem%2F%3C%2FA%3E...%3C%2FP%3E%3CP%3EThe%20webLink%20is%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Foutlook.office365.com%2Fowa%2F%3Fitemid%3DAAMkADBiNDA2...AAA%253D%26amp%3Bexvsurl%3D1%26amp%3Bpath%3D%2Fcalendar%2Fitem%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office365.com%2Fowa%2F%3Fitemid%3DAAMkADBiNDA2...AAA%253D%26amp%3Bexvsurl%3D1%26amp%3Bpath%3D%2Fcalendar%2Fitem%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EDiego%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1346722%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1346722%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F402611%22%20target%3D%22_blank%22%3E%40diegoSpace%3C%2FA%3E%26nbsp%3B%2C%20That%20is%20a%20webLink%20for%20sure%20it%20will%20work%20in%20web%20only%2C%20If%20you%20want%20to%20open%20within%20Teams%20you%20can%20use%20joinWebUrl%20that%20will%20open%20within%20Teams%20Desktop%20client.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1346798%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20Teams%20calendar%20event%20from%20a%20bot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1346798%22%20slang%3D%22en-US%22%3EGo%20to%20the%20Group%20you%20want%20the%20calendar%20for%3A%3CBR%20%2F%3EClick%20%E2%80%9CCalendar%E2%80%9D%3A%3CBR%20%2F%3ECopy%20the%20URL%20from%20your%20browser%3A%3CBR%20%2F%3EAdd%20a%20new%20tab%20within%20a%20Channel%20in%20Teams%3A%3CBR%20%2F%3ESelect%20%E2%80%9CWebsite%E2%80%9D%3A%3CBR%20%2F%3EAdd%20a%20name%20and%20the%20URL%20you%20copied%20from%20the%20Outlook%20Web%20App%3A%3CBR%20%2F%3ESign%20in%20to%20Microsoft%20when%20prompted.%3C%2FLINGO-BODY%3E
Contributor

Hi,

I have a nodejs bot running with my Teams app. I would link to add a new meeting event in Teams calendar, is it possible? I have read about 'schedules' in Graph API, but I am not sure if this is the key, since I can not see fields like startTime, duration, ...

Could you please help me?

Thanks in advance,

Diego

16 Replies

@diegoSpace - Could you please try Graph API to create calendar event.

@Nikitha-MSFT Thanks for your response.

 

I have some doubts, please correct what I write below if required:

 

As far as I understand, I can use Application permission to create an event, so I will access Graph without a user (https://docs.microsoft.com/en-us/graph/auth-v2-service)

 

I will use 'POST /users/{id}/events', where the {id} must be Teams userId (what I get in 'activity.from.id' of an incoming command), and not the Office365/Azure id.

 

'Bearer' header is required, so I need a token. I have running code to get Teams users, and previously I get a bearer token with this options:

 

var options = {
    uri: 'https://login.microsoftonline.com/{tenant ID}/oauth2/v2.0/token',
    method: 'POST',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    body: 'client_id=' + {appId} + '&client_secret=' + {appPassword} + '&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default&grant_type=client_credentials',
};

 

With the token received in the response, I can access to the users in a Teams group:
      https://graph.microsoft.com/v1.0/groups/{groupID}/members

 

Can I use this token (for my application) to create an event for a user from the bot?

 

With a userId = '29:184h5dKIrOfsVklZrZyWMe91Gio.....nNQiCqFNLreLIEq-YC' I have tried this PUT:
      https://graph.microsoft.com/v1.0/users/{userId}/calendar/events
      and the previous Authentication bearer token
      with an example event as body

 

but I get a '500 Internal Server Error' as response.

 

What am I doing wrong?

Thanks a lot,

Diego

@diegoSpace - {id} should be user azure id or UPN. Could you please try using the azure id or UPN.

@Nikitha-MSFT Thanks, Using the Azure id i get this error response:

 

"code": "ErrorInvalidRequest",
"message": "The OData request is not supported.",

 

 

 

@diegoSpace - Could you please share your request body what you are trying?

@Nikitha-MSFT I used the example body from

https://docs.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0&tabs=http

 

(updated date & timezone)

 

{
     "subject": "Let's go for lunch",
     "body": {
          "contentType": "HTML",
          "content": "Does late morning work for you?"
     },
     "start": {
          "dateTime": "2020-04-15T12:00:00",
          "timeZone": "Europe/Madrid"
     },
     "end": {
          "dateTime": "2020-04-15T14:00:00",
          "timeZone": "Europe/Madrid"
     },
     "location":{
          "displayName":"Harry's Bar"
     },
     "attendees": [
          {
               "emailAddress": {
                    "address":"samanthab@contoso.onmicrosoft.com",
                    "name": "Samantha Booth"
               },
               "type": "required"
          }
     ]
}     

@diegoSpace , Do you have required Calendar.ReadWrite permission in your access token? You can check that on jwt.io.

@Trinetra-MSFT Thanks for your response, on jwt.io I could see my permissions, and there was no permission for Calendar. I added it in my app (Azure) and then retried:

 "roles": [
        "User.ReadWrite.All",
        "Group.Read.All",
        "Directory.ReadWrite.All",
        "Directory.Read.All",
        "User.Read.All",
        "GroupMember.Read.All",
        "Calendars.ReadWrite"
],

 

But with that token I still have the error:

     "The OData request is not supported."

 

Is "Calendars.ReadWrite" permission the only required? It is without '.All' (like the others), I have not found the '.All' one...

 

My raw request is:

 

PUT /v1.0/users/bcb3f5a......23a5925/calendar/events HTTP/1.1
Authorization: Bearer eyJ0eXAiOiJKV1Q.....EUquw
Host: graph.microsoft.com
Content-Type: application/json
Content-Length: 548

{
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does late morning work for you?"
},
"start": {
"dateTime": "2020-04-15T12:00:00",
"timeZone": "Europe/Madrid"
},
"end": {
"dateTime": "2020-04-15T14:00:00",
"timeZone": "Europe/Madrid"
},
"location":{
"displayName":"Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address":"samanthab@contoso.onmicrosoft.com",
"name": "Samantha Booth"
},
"type": "required"
}
]
}

 

Thanks a lot,

Diego

 

@diegoSpace , I see you are hitting the Put request , Ideally it should be POST:

POST /v1.0/users/{UserPrincipleName}/calendar/events. Try with this and let me know, how it goes,

Please take a look at Example 5.

@Trinetra-MSFT Thanks for your response, that was the problem. I don't know why i was using PUT (i think I see it somewhere), but event documentation says clearly 'POST'.

 

By the way, which version of Graph API should I used? 1.0 or beta?

 

Thanks a lot!

Diego

@diegoSpace , If you are looking to Create a Event in user calendar you can use v1.0 but if you want to get the joinWebUrl too than go for beta version. create event with online meeting provider api is in beta version.

@Trinetra-MSFT Thanks. Is it possible to open Teams Calendar view programatically (or even recently created event) once I receive the event creation response? My Teams event is created from a Messaging extension dialog, and I would like to open it once created

@diegoSpace , I've not seen this but I assume that you can try to deep link the webLink Url with Teams

@Trinetra-MSFT If I use microsoftTeams.executeDeepLink(webLink) in my Teams task the created event is open but in a browser (not in Teams client I mean):
         https://outlook.office365.com/calendar/item/...

The webLink is: https://outlook.office365.com/owa/?itemid=AAMkADBiNDA2...AAA%3D&exvsurl=1&path=/calendar/item

 

Thanks,

Diego

@diegoSpace , That is a webLink for sure it will work in web only, If you want to open within Teams you can use joinWebUrl that will open within Teams Desktop client. 

Go to the Group you want the calendar for:
Click “Calendar”:
Copy the URL from your browser:
Add a new tab within a Channel in Teams:
Select “Website”:
Add a name and the URL you copied from the Outlook Web App:
Sign in to Microsoft when prompted.