Why PrincipalSearcher gives System.__ComObject for attribut msExchRecipientDisplayType?
Asked Answered
B

1

0

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 ??

Bittencourt answered 10/6, 2020 at 14:40 Comment(0)
G
1

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
};
Greisen answered 10/6, 2020 at 14:58 Comment(4)
Sure I will update code after few hrs. I receiving system.comobject in principle searchr ... But it is fine by directory searcher. But directory searcher has 1000 page limit. So it's not worth.Bittencourt
To get more than 1000 you just need to set the PageSize, like I described in this answer.Greisen
PageSize property of the DirectorySearcher give first 1000 results every time. How it could other results means next results??Bittencourt
Can you update your question with the code you are using? When I set PageSize = 1000, I get thousands of results from my domain, in pages of 1000.Greisen

© 2022 - 2024 — McMap. All rights reserved.