The code below is used to get calendar from my email account through Microsoft Graph. But I keep getting an error. I can get the list of places and user information, but I can´t get the calendar.
I´ve tried this code:
CODE :
gsO365_ClientID est une chaîne = "..."
gsO365_ClientSecret est une chaîne = ".."
dGdO365_ClientSecret_Expiration est une Date = ".."
gsO365_Tenant est une chaîne = ".."
gsO365_URICallBack_WEB est une chaîne = "http://localhost/inscription/WD260AWP/WD260Awp.exe/OAUTH2_RETOUR"
gsO365_URICallBack_WEB_Test est une chaîne = "http://localhost/WD250AWP/WD250Awp.exe/OAUTH2_RETOUR"
sGsO365_URICallBack_APP est une chaîne = ".."
OAuth2Params est OAuth2Paramètres
OAuth2Params..ClientID = gsO365_ClientID
OAuth2Params..URLAuth = "https://login.microsoftonline.com/[%gsO365_Tenant%]/oauth2/v2.0/authorize"
OAuth2Params..URLToken = "https://login.microsoftonline.com/[%gsO365_Tenant%]/oauth2/v2.0/token"
OAuth2Params..ParamètresSupplémentaires = "force_reapprove=false"
OAuth2Params..Scope = "offline_access Calendars.Read"
MonToken est un AuthToken = AuthIdentifie(OAuth2Params)
oRequête est une httpRequête
oRequête.Méthode = httpGet
oRequête.URL = "https://graph.microsoft.com/v1.0/me/calendar/events"
oRequête.ContentType = "application/json"
oRequête.AuthToken = MonToken
Réponse est une httpRéponse
jsRéponse est un JSON
Réponse = HTTPEnvoie(oRequête)
SI ErreurDétectée ALORS
Erreur("La requête HTTP à Office 365 a échouée"+RC+ErreurInfo())
RENVOYER Faux
SINON
jsRéponse = Réponse..Contenu
Trace(Réponse..Contenu)
// Le serveur a renvoyé une erreur
SI jsRéponse.Error..Existe ALORS
Erreur("La requête à Office 365 a échouée"+RC+jsRéponse.Error.Message)
SINON
Trace(jsRéponse)
FIN
FIN