In Outlook I created a UserForm which gets a User from the domain and display his lastlogon, expiredate, group memberships, etc. But for the group memberships it only displays Security type groups, not distribution type groups of the selected User.
I'm trying to get both (Security and distribution groups) but can't figure out how to do this. Not even with the help of my big friend Google.
I'm guessing Objuser.Groups is the problem, but .memberOf or .Members does not seems to work.
What am i doing wrong?
snapshot of the code:
Sub FindUser(Username As String)
Dim objGroup As Object
Dim Objuser As IADsUser
Set WSHnet = CreateObject("WScript.Network")
UserDomain = WSHnet.UserDomain
Set Objuser = GetObject("WinNT://" & UserDomain & "/" & Username & ",user")
For Each objGroup In Objuser.Groups
'!!at this part I only get the Security type groups, not the distribution groups!!
'Do things with the objGroup
Next