Solved

When exporting data via ldap from AD, using javascript how do i extract just part of the string returned?

Posted on 2011-03-01
4
554 Views
Last Modified: 2013-11-21
I am currently exporting data from Active Directory via ldap into another database.

I want to extract the user's ldap.manager. But i only want the name not the full OU path.

The value returned is something like:
CN=Smith\, Mike,OU=Development Control,OU=Public Protection.

Using javascript I want to just extract the manager as 'Mike Smith' from the above.

Can anyone help?
0
Comment
Question by:TSG_Firstline
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
daveamour earned 250 total points
ID: 35008907
Try something liek this:

<script language="javascript" type="text/javascript">
            var test = "CN=Smith\, Mike,OU=Development Control,OU=Public Protection";
            
            alert(test.split(',')[1] + " " + test.split(',')[0].split('=')[1]);
        </script>

Open in new window

0
 

Author Comment

by:TSG_Firstline
ID: 35009043
Ahh nice thats pretty much it. Gives me "Mike Smith\" but removing the trailing "/" is no issue.

Many thanks.
0
 

Author Closing Comment

by:TSG_Firstline
ID: 35009053
Prompt response & spot on.
0
 
LVL 19

Expert Comment

by:daveamour
ID: 35009731
Yes sorry about the \ - didn't show up in the alert!
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Some time ago I faced the need to use a uniform folder structure that spanned across numerous sites of an enterprise to be used as a common repository for the Software packages of the Configuration Manager 2007 infrastructure. Because the procedu…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question