Closed bwlonsdaledxc closed 1 year ago
Looking into this, may take me a little time. Latest version of MSAL will only work in PS7, it fails to load in PS5. I think the best option is to try and remove the dependency on MSAL altogether (it is only required for cert auth, but I should be able to implement that manually).
I've just uploaded v1.2.8 which fixes the cert auth. You can use the latest version of MSAL in PowerShell 7 (I've fixed another issue in the script that stopped it working there). If using PowerShell 5.1 you'll need to stick with v4.45.0.0 (later versions have dependencies not available in 5.1). Tested this in both PowerShell versions, seems to be working though I haven't run a test long enough to confirm OAuth token renewal works as expected.
It's working, but I am seeing the following error:-
Please can you try installing this package see if it resolves?
Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
The failure is in the trace listener, which shouldn't be fatal (though will prevent throttling detection).
I can't, but I know a man who can probably install that :)
I can also workaround it by changing the path on line 679 from ".\Microsoft.Exchange.WebServices.dll" to the full path where it is "G:\
Could an alternative be to change that in the script to provide the full path to where it found it?
Oh, good spot - that is likely to be the issue rather than the compiler platform missing (if it works by correcting the path, you won't need to install any other packages). Didn't realise I'd not updated the path for the EWS API (so it will only work if the script is in the same folder as the EWS API, which is my testing config). I'll update that.
MIne's in same folder too, but I am calling it from my wrapper script which I guess is the issue for me
Change line 679 to this: Add-Type -TypeDefinition $TraceListenerClass -ReferencedAssemblies $EWSManagedApiPath
Sorted, thanks
Pushed that update into v1.2.9 (now live). Closing this one off.
Hi David, trying to get this script working with certificate authorisation and think I'm struggling with permissions that need to be on the app registration.
I have that set at the moment. The cert itself works fine against another app registration I have (it connects to the mailbox fine), and script works fine when using the secret key method, I am just swapping -OauthSecretKey for -OAuthCertificate on the command line.
The script attempts to build the list of items to move, but seems to fail: Error when querying items: You cannot call a method on a null-valued expression.
I am using Microsoft.Identity.Client.dll v4.45.0.0 (anything later fails)