When I try to update an Active Directory attribute with this code:
dn = (
"CN=user_ldap,OU=dept_name,OU=Application,"
"OU=Service Accounts,OU=Domain Users,DC=company-corp,DC=global"
)
# define the server
server = ldap3.Server(
"ldaps.company-corp.global", get_info=ldap3.ALL, port=636, use_ssl=True
)
# define the connection
conn = ldap3.Connection(server, dn, psw, auto_bind=True)
conn.start_tls()
userID = "jdoe"
# perform the Modify operation
conn.modify(
f"CN={userID},OU=managed,OU=Domain Users,DC=company-corp,DC=global",
{"displayName": [(ldap3.MODIFY_REPLACE, ["Doe, John D"])]},
)
print(conn.result)
I get the following error:
{'result': 32, 'description': 'noSuchObject', 'dn': 'OU=Managed,OU=Domain Users,DC=company-corp,DC=global', 'message': "0000208D: NameErr: DSID-03100241, problem 2001 (NO_OBJECT), data 0, best match of:\n\t'OU=Managed,OU=Domain Users,DC=ssnc-corp,DC=global'\n\x00", 'referrals': None, 'type': 'modifyResponse'}
Please advise.
Thanks in advance.