Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 22, 2008 02:17 PM by lantonio1974
Member
15 Points
107 Posts
Oct 21, 2008 01:20 PM|LINK
This is for updating the CN property in active directory.
The manager string coming from the database is: LastName, FirstName
The CN in Active Directory should be updated like this: CN=LastName\\, FirstName,CN=Users,DC=domain,DC=net
I am trying this: dentry.Properties["manager"]. Value = oEmployee.Manager;
oEmployee.Manager comes from a datareader.
Any help or idea on how I can make this work will be very appreciated.
Thanks.
All-Star
21838 Points
4822 Posts
Oct 21, 2008 01:42 PM|LINK
I am sorry but I didn't get your question.
How should the value look like when it's inserted in dentry.Properties["manager"] and how does it look now. I mean what does the source data look like and what does the target data look like?
Oct 21, 2008 01:51 PM|LINK
When is going to be inserted is Doe, Joe. From the source is the same is how is save in the database, LastName, FirstName.
Distinguished Name in CN=Manager Properties CN=Manager,CN=Schema,CN=Configuration,DC=domain,DC=net
dentry.Properties["manager"].Value = @"CN=Doe\, Joe,CN=Users,DC=domain,DC=net";
I hope I answer your questions correctly.
Oct 21, 2008 01:57 PM|LINK
See if this is what you are looking for:
string name = oEmployee.Manager; string firstName = ""; string lastName = ""; if(name.Contains(",")) { string[] split = name.Split(new Char[] { ',' }); lastName = split[0]; firtName = split[1]; } dentry.Properties["manager"].Value = @"CN="+ lastName +"\, "+ firstName +",CN=Users,DC=domain,DC=net";
Oct 21, 2008 02:51 PM|LINK
+"\, " = This is giving me an Unrecognized scape sequence.
Oct 21, 2008 03:00 PM|LINK
Try this:
"\\, "
Oct 21, 2008 03:09 PM|LINK
I got an error:
"An invalid dn syntax has been specified."
:(
Oct 21, 2008 03:12 PM|LINK
Were you able to insert value before doing any modifications, like when you used John Doe.
Oct 21, 2008 03:21 PM|LINK
I have just notice that the record form the database is all in Upper Case and in AD is only the first letter in Upper.
Can this be causing the Invalid dn error?
Oct 21, 2008 03:30 PM|LINK
I am not sure about that but did you try what I suggested in my previous post to use John Doe.
lantonio1974
Member
15 Points
107 Posts
Convert String to CN property
Oct 21, 2008 01:20 PM|LINK
This is for updating the CN property in active directory.
The manager string coming from the database is: LastName, FirstName
The CN in Active Directory should be updated like this: CN=LastName\\, FirstName,CN=Users,DC=domain,DC=net
I am trying this: dentry.Properties["manager"]. Value = oEmployee.Manager;
oEmployee.Manager comes from a datareader.
Any help or idea on how I can make this work will be very appreciated.
Thanks.
bullpit
All-Star
21838 Points
4822 Posts
Re: Convert String to CN property
Oct 21, 2008 01:42 PM|LINK
I am sorry but I didn't get your question.
How should the value look like when it's inserted in dentry.Properties["manager"] and how does it look now. I mean what does the source data look like and what does the target data look like?
Max
Let Me Google That For You!
lantonio1974
Member
15 Points
107 Posts
Re: Convert String to CN property
Oct 21, 2008 01:51 PM|LINK
When is going to be inserted is Doe, Joe. From the source is the same is how is save in the database, LastName, FirstName.
Distinguished Name in CN=Manager Properties
CN=Manager,CN=Schema,CN=Configuration,DC=domain,DC=net
dentry.Properties["manager"].Value = @"CN=Doe\, Joe,CN=Users,DC=domain,DC=net";
I hope I answer your questions correctly.
bullpit
All-Star
21838 Points
4822 Posts
Re: Convert String to CN property
Oct 21, 2008 01:57 PM|LINK
See if this is what you are looking for:
string name = oEmployee.Manager; string firstName = ""; string lastName = ""; if(name.Contains(",")) { string[] split = name.Split(new Char[] { ',' }); lastName = split[0]; firtName = split[1]; } dentry.Properties["manager"].Value = @"CN="+ lastName +"\, "+ firstName +",CN=Users,DC=domain,DC=net";Max
Let Me Google That For You!
lantonio1974
Member
15 Points
107 Posts
Re: Convert String to CN property
Oct 21, 2008 02:51 PM|LINK
bullpit
All-Star
21838 Points
4822 Posts
Re: Convert String to CN property
Oct 21, 2008 03:00 PM|LINK
Try this:
"\\, "
Max
Let Me Google That For You!
lantonio1974
Member
15 Points
107 Posts
Re: Convert String to CN property
Oct 21, 2008 03:09 PM|LINK
I got an error:
"An invalid dn syntax has been specified."
:(
bullpit
All-Star
21838 Points
4822 Posts
Re: Convert String to CN property
Oct 21, 2008 03:12 PM|LINK
Were you able to insert value before doing any modifications, like when you used John Doe.
Max
Let Me Google That For You!
lantonio1974
Member
15 Points
107 Posts
Re: Convert String to CN property
Oct 21, 2008 03:21 PM|LINK
I have just notice that the record form the database is all in Upper Case and in AD is only the first letter in Upper.
Can this be causing the Invalid dn error?
bullpit
All-Star
21838 Points
4822 Posts
Re: Convert String to CN property
Oct 21, 2008 03:30 PM|LINK
I am not sure about that but did you try what I suggested in my previous post to use John Doe.
Max
Let Me Google That For You!