How to find ActiveSync attributes from Exchange using C #?

I am trying to find some ActiveSync attributes from Exchange. I found a good article that shows the PowerShell cmdlet to find this information. But I'm trying to find where this information is stored. I looked at my custom objects in ADSI to see if any of the properties would be these values, but that doesn't seem to be the case. How to find this information using C #?

+4
source share
2 answers

To get ActiveSync attributes for a specific ActiveDirectory object (i.e. user), you can use the CASMailbox class.

It has a constructor that uses ADObject, and then gives you several properties, such as HasActiveSyncDevicePartnership - you can even change them (provided that you need permissions).

EDIT - according to the comments:

The CASMailbox class has everything you ask for.
For example, ActiveSyncMailboxPolicy , which is an ADObjectId , which in turn can be requested for several properties ...
Another example is ActiveSyncAllowedDeviceIDs , which is MultiValuedProperty , which you can request for DeviceID, etc.

This method of accessing properties may not be very pleasant, but it certainly gives you all the information ... if you want to get some pretty good source code (which in this case works with PS), see <a2>

0
source

Get-CASMailbox will provide you with basic information such as HasActiveSyncDevicePartnerShip . These properties are stored in the active directory, you can view them using adsiedit directly under the user account.

If you need more properties such as DeviceFriendlyName, LastSuccessSync, DeviceImei , they should be extracted from the mailbox itself using the PS Cmdlet Get-MobileDeviceStatistics command.

There are several methods for using PS CmdLets inside C # code, for sharing you probably want to use PS Remoting: fooobar.com/questions/1379476 / ...

0
source

Source: https://habr.com/ru/post/1379474/


All Articles