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
562 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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

Remote Apps is a feature in server 2008 which allows users to run applications off Remote Desktop Servers without having to log into them to run the applications.  The user can either have a desktop shortcut installed or go through the web portal to…
Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
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…

713 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