MSTdev
MSTdev

Reputation: 4635

Why PrincipalSearcher gives System.__ComObject for attribut msExchRecipientDisplayType?

Why PrincipalSearcher gives System.__ComObject for attribut msExchRecipientDisplayType ??

I want to retrieve attribute msExchRecipientDisplayType and PrincipalSearcher gives System.__ComObject. Also I tried to retrieve it by DirectorySearcher and it gives correct value

i.e. ''.

0 UserMailbox (shared)
1 MailUniversalDistributionGroup
6 MailContact
7 UserMailbox (room)
8 UserMailbox (equipment)
1073741824 UserMailbox
1073741833 MailUniversalSecurityGroup

as mentioned here https://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_exchon-mso_o365b/recipient-type-values/7c2620e5-9870-48ba-b5c2-7772c739c651

But DirectorySearcher has only 1000 limit ??

Upvotes: 0

Views: 155

Answers (1)

Gabriel Luci
Gabriel Luci

Reputation: 40988

Without seeing your code, I don't know why you're seeing a System.__ComObject value for the msExchRecipientDisplayType attribute.

About the 1000 result limit: this is a limit from Active Directory, not just DirectorySearcher. To get more results, you need to enable paging, which you can do by setting the PageSize property of the DirectorySearcher. Just set it to 1000 and it will keep making new queries for the next thousand until there are no more. For example,

var ds = new DirectorySearcher() {
    Filter = "(&(objectClass=user)(objectCategory=person))",
    PropertiesToLoad = { "msExchRecipientDisplayType" },
    PageSize = 1000
};

Upvotes: 1

Related Questions