c# - EWS Get mailbox type (user/resource/shared) -
given email address, connect mailbox receives emails sent address:
ews.autodiscoverurl(email); var m = new mailbox(email); var folderid = new folderid(wellknownfoldername.inbox, m); var folder = folder.bind(ews,folderid); is there way find out kind of mailbox opened - whether user, resource or shared mailbox?
you can find mailbox type given email address calling resolvename:
var mailboxes = ews.resolvename(email); if (mailboxes.any()) { var mailbox = mailboxes.first(); if (mailbox.mailboxtype == mailboxtype.publicfolder) { // magic } } see msdn page possible values of mailboxtype.
updatethere no distinction between regular mailbox , mailbox room. if want know rooms exist in exchange server, can utilize the ews getroomlists , getrooms functions.
by combining snippet above getroomlists/getrooms, can mailbox room. maintain in mind: there may rooms without mailbox.
the approach using getroomlists/getrooms 1 allow identify room's mailbox using ews. require have rooms added room list, may require bribe administrator or two.
the alternative relevant info in active directory, apparently outlook does. see msdn thread more elaborate explanation, gist:
outlook has own directory interfaces doesn't utilize ews information. if going utilize ews need administrator create roomlist use.
the lastly alternative utilize powershell mailbox type. used rooms in exchange online server:
ps h:\> get-mailbox | {$_.resourcetype -eq "room"} the output:
name alias servername prohibitsendquota ---- ----- ---------- ----------------- frank's room franksroom db3pr03mb058 49.5 gb (53,150,220,288 bytes) another illustration generates same output:
ps h:\> get-mailbox -filter '(recipienttypedetails -eq "roommailbox")' with output can mailbox either of these:
exchange.resolvename("frank's room"); exchange.resolvename("franksroom@myorganization.onmicrosoft.com"); a few relevant links that:
powershell commands room mailbox management connect exchange online using powershell c# ews
No comments:
Post a Comment