Closed maphew closed 7 years ago
Look at get_allowed_attributes in the docs.
thanks! that does the trick. Perhaps this example could be folded into the docs somewhere to help someone else:
'''Display all attributes for the selected group member which contain values'''
from pyad import adgroup
group = adgroup.ADGroup.from_dn(group_name + org_unit + domain)
members = group.get_members()
peep = members[5] # select 6th group member
for a in peep.get_allowed_attributes():
value = getattr(peep, a)
if value:
print '{0:30}:{1}'.format(a, value)
This is probably a documentation issue, not a bug; with #34 solved I bump into my next question: What attributes are available for reporting from a person object?
Successful result:
Perry.Smith Tiddlywinks Administrator
So have something that works for displaying the name and description for a single user but I want to display more information such as phone number, office location, etc. I don't know how to find out attributes are available for reporting. For example
peep.displayname
which clearly works is not in the list returned bydir(peep)
.