Setting AD object attribute to a value including a newline

I have an ObjectRequest for a group creation in an AD application, and I want to put a multi-line value in the “info” field (appearing as “Notes” in ADUC). When I just include a Java newline in the string, it doesn’t break to a new line in ADUC; it just continues as if the newline character is not there. Is there a special character sequence that I should be using to specify a line break in AD?

derek_kehnert,

You may want to try a carriage return and line feed combination when targeting Active Directory. In Java, the characters are \r and \n.

String address = address1 + "\r\n" + address2 + "\r\n" + city + ", " + region + " " + postalCode;

Rob

3 Likes

Thank you, this was the solution (I was only using \n instead of \r\n).

1 Like