I don't have that much experience with AD but from looking online I've found how to programatically create users through C#. I've also read up on custom attributes and what I was hoping to do was to create a new custom attribute, let's say 'myNewAttribute' and populate it as part of the user creation.
I had thought that if I add this custom attribute in AD then it should be possible to populate it on every account creation but maybe it needs to be created each time?
Assuming it does not need to be created each time, up until now I've created users by doing something like:
using(var pc = new PrincipalContext(ContextType.Domain, <SERVER HERE>,username,password))
{
using(var up = new UserPrincipal(pc)){
up.UserPrincipalName = "whatever";
up.Save();
}
}
What I would ideally like to be able to do is:
up.myNewAttribute = "new value here";
Is this possible or if not how can I set the attribute value here?
DirectoryEntryfor this. Please check stackoverflow.com/questions/36100121/…