简体   繁体   中英

The best practice to check if account's login/password is valid in EWS Managed API, C#

I don't see any method in EWS which just checks if the specified login/password are OK. All method do something else (eg list folders) which would be waste of resources in my case. What if I just need to make sure the login/pass is OK (and Exchange server is up). What method should I call?

Here ( Validate login credentials using EWS Managed API ) they are using FindFolders which seems a bit heavy for me. Or is is perfectly normal and EWS anyway doesn't provide any light-weight alternative?

Binding to the Inbox Folder is generally the best approach IMO eg

Folder Inbox = Folder.Bind(service, WellKnownFolderName.Inbox);

It really depends what you mean by valid eg a Mailbox server maybe accessible but the particular mailbox you want to access maybe inaccessible because its being in the process of being moved. Or your credentials maybe okay but if you want to access another users mailbox these credentials won't have the correct rights. Binding to a folder (which just makes one call) will tell you the credentials are good, the Mailbox is available and you have rights to that folder.

CovertId is generally the Lightness call you can make to EWS as it doesn't access the Mailbox itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM