Open brukwa opened 7 years ago
There are caches in play. When you remove a mailbox, it deletes the user account associated with the mailbox. When you then call New-Mailbox, even though you are using the same UPN/Email address, the new account gets a new security identifier. It may be related to AD replication or caching in the EWS layer. In either case, you can consider this a transient condition. The caches I am thinking of are on the server side, but the client app is holding onto a session that have creds, and depending on the auth strategy, the token could be stale after such a deleted+create.
I have problem with connecting to a mailbox that was recently removed and created again with the same login data (Name, UPN, Email Address and Password).
This is a sample code that shows the issue.
I have started an application and run my sample code. So far so good. After a while I am removing my sample mailbox via Remove-Mailbox cmdlet and recreate it with New-Mailbox cmdlet. Now I am trying to run again the code above. As a result I receive two types of exception i.e.: ErrorInvalidSerializedAccessToken or ErrorMailboxConfiguration.
The problem is solved after restarting sample application application again. I have checked similar scenario with Ews Editor and it works fine. It seems like there is some caching involved internally, but I was unable to locate it nor work it around.