Any news - ?
After 1/2 year API 403 error
I have a PowerShell script that runs daily and creates a folder in the employee contact lists via token (request) and writes the company's contacts in it so that everyone has them on their cell phone. The next day, this folder is deleted and the contacts are rewritten. This has now worked wonderfully for six months.
Now it suddenly no longer works if the folder already exists. That is, it Invoke-RestMethod. It can no longer delete it (Error 403). But with one user it works about 95%, all other 42 do not work. I don't understand why? It makes no sense! Why for this user, but not for all the others?
The script continues to run without problems if you manually delete the contact folder.
I checked all permissions, made new API and gave much more permissions, manually connected, renamed folders, etc. No results.
The approximate procedure is as follows:
Request Access Token:
Invoke-RestMethod $url4Token -Method 'POST' -Headers $Headers4Token -Body $Body4Token
Delete contact folder:
Invoke-RestMethod $url -Method 'DELETE' -Headers $headers -Body $body
Create contact folder:
Invoke-RestMethod $url -Method 'POST' -Headers $headers -Body $body
Write in a loop all contacts fetched from AD (by Json)
Invoke-RestMethod $url -Method 'POST' -Headers $headers -Body $json
If you need any information, please just let me know. I will try my best.
Thanks for any help.