I spent quite a few weeks earlier this year writing a PowerShell utility to copy mail between users in a O365 Tenant (including the ability to place copied mail in a unique 'root' folder tree). After much trial and error I had a working script that did what I needed. I use a mix of EWS and EWS managed API calls, I've resolved token (refresh), service, impersonation and Application API access issues. Last used successfully 3/19/24.
The following week or 10 days later I revisited the code and found that all the features were still functioning - except UploadItems. The response from that is now: Access is denied. Check credentials and try again., The process failed to get the correct properties.
I tested my code against 4 of the Tenants I manage and found the same error for all of them. They had all worked previously. I've tested my Impersonation 'credentials' (tenantID, clientID, clientsecret) using EWSEditor - no issues. I've spent the last 3 weeks going over everything - script and tenants - I'm not getting anywhere. It feels like Microsoft changed something and didn't tell anyone.
Code snippets available upon request. I didn't post the code because I'm not get any code failures - I just can't UploadItems to the target mailbox.
Your help greatly appreciated. But I would also appreciate if you wouldn't reply with how-to links - this WAS working, I just need to know what changed and how to code for it.
Regards,
jbw