|
FOROS PROFESIONALES WINDEV, WEBDEV y WINDEV Mobile |
| | | | | |
| connect to the Sharepoint REST API |
| Iniciado por madiha.chokraoui, 31,ene. 2018 17:51 - 4 respuestas |
| |
| | | |
|
| |
| Publicado el 31,enero 2018 - 17:51 |
Bonjour,
J'essaye de faire un programme windev qui me permet d'aller chercher des attachements d'une listitem sharepoint,
J'ai eu un problème avec la connexion, voila mon code:
OAuth2Params est un OAuth2Paramètres Montoken est un AuthToken OAuth2Params..ClientID = "XXXXXXXXXXXXXXXXXXXXXXXX" OAuth2Params..ClientSecret = "XXXXXXXXXXXXXXXXXXXXXXXXXX" OAuth2Params..URLAuth = "https://login.microsoftonline.com/tenant/oauth2/authorize" OAuth2Params..URLToken = "https://login.microsoftonline.com/tenant/oauth2/token" OAuth2Params..URLRedirection = "http://localhost:XXXX/" OAuth2Params..Scope = "Web.Write" Montoken = AuthIdentifie(OAuth2Params)
SI Montoken <> Null ALORS SI ErreurDétectée ALORS Erreur(ErreurInfo()) SINON cMyRequest is httpRequest cMyRequest..Méthode = httpGet //cMyRequest..url = "https://XXXX.sharepoint.com/sites/Mysite/_api/lists/getByTitle('Test')/items('2')?$select=AttachmentFiles,Title&$expand=Attachments" cMyRequest..ContentType = "application/json" cMyRequest..AuthToken = Montoken cMyResponse is httpResponse = HTTPEnvoie(cMyRequest) IF ErrorOccurred THEN Error(ErrorInfo(errFullDetails)) ELSE Trace(cMyResponse..Contenu) FIN END
FIN
voici la réponse renvoyer: <?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code>-2147024891, System.UnauthorizedAccessException</m:code> <m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</m:message></m:error>
Pourriez vous m'aider??? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 03,octubre 2018 - 17:17 |
Avez-vous trouvé une solution? Merci. |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 44 mensajes |
|
| Publicado el 05,abril 2019 - 13:10 |
Bonjour j'ai le même problème ... vous avez trouvé la solution ? Merci |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 324 mensajes |
|
| Publicado el 05,abril 2019 - 15:14 |
Au vu du message, il faut vérifier la configuration sur sharepoint de l'accès par oAuth2 et vérifier que le scope Web.Write est bien déclarer comme utilisable par ce ClientID.
Dans la mesure ou les URL sont juste, le scope est correcte. La seule explication c'est que le client n'a pas lui l'autorisation d'utiliser ce droit précis  |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 44 mensajes |
|
| Publicado el 05,abril 2019 - 16:07 |
Merci Reppa Voici comment j'ai configuré ma connexion mais à priori mon scope n'est pas bon il faut mettre l'url du site sharepoint ?
Montoken est un AuthToken OAuth2Params..ClientID = "a3a4XXXXXXXXXXXXXXc0de" OAuth2Params..ClientSecret = "uXXXXXXXXXXXX" OAuth2Params..URLAuth = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize" OAuth2Params..URLToken = "https://login.microsoftonline.com/common/oauth2/v2.0/token" OAuth2Params..URLRedirection = "http://localhost:9874/" OAuth2Params..Scope = "web.write" |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|