Check if a user exists in AD before creating

Hi Friends,
We are implementing AD for authentication.Now the requirement is that whenever we create a user in application,we need to check whether the username exists in AD.If it doesnt exists we should not create the user. Please how to check if a username exists in AD.
Thanks
Sasi

Hi Patrick,
Thanks for the link.That's what I exactly needed.
But when I tried to use APEX_LDAP.GET_USER_ATTRIBUTES procedure, I'm getting ORA-31202: DBMS_LDAP: LDAP client/server error: Invalid credentials. 80090308: LdapErr: DSID-0C090334,.
I'm sure that the username and the password which I passed are valid and with the same credentials I can able to login to apex application which has LDAP authentication.
So I tried without password,but got ORA-06502: PL/SQL: numeric or value error
Could you please explain what exactly goes wrong..?
Thanks
Sasi

Similar Messages

  • How to check whether portal user exists or not using UM API.

    Hi Experts,
    Let us say i need to create an user account "PortalUser",i know how to create an user,setting first name,lastname,password for that.
    but here before creating the portal user, i need to check whether that user exists or not.If user already exists ,then i  need to skip the below for creating the user.
    IUserFactory userFact = UMFactory.getUserFactory();
    IGroupFactory groupFact = UMFactory.getGroupFactory();
    IRoleFactory roleFact = UMFactory.getRoleFactory();
    IUser tuser = userFact.getUserByLogonID("PortalUser");
    IUserMaint newUser = userFact.newUser("PortalUser");
    newUser.setFirstName("PortalUser");
    newUser.setLastName("Test");
    newUser.setEmail("PortalUser.Testatgmaildotcom");
    //Locale PortalLanguage = new Locale(Lang.toLowerCase(), "");
    Locale PortalLang=new Locale("en");
    newUser.setLocale(PortalLang);
    newUser.save();
    newUser.commit();
    IUserAccount userAcc = UMFactory.getUserAccountFactory().newUserAccount("PortalUser", newUser.getUniqueID());
    userAcc.setPassword("test1test$");
    userAcc.save();
    userAcc.commit();     
    Thanks in advance.
    Thanks
    Sony.

    Hi,
    Try this code,
    IUserFactory factory = UMFactory.getUserFactory();
    IUser user = factory.getUserByLogonID(userId);
    lastName = user.getLastName();
    firstName = user.getFirstName();
    refer this pdf,its very helpful
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/webinars-nw-rig/using%20the%20user%20management%20api%20with%20ep%20applications%20-%20webinar%20powerpoint.pdf
    Regards,
    Sunaina Reddy T

  • Why we create settlement profile. What master data must exist in sap before creating settlement profile for order.

    Why we create settlement profile. What master data must exist in sap before creating settlement profile for order.

    As mentioned above, settlement is to post the cost to cost centers or any possible receivers as per the settlement profile. PM / Service orders, WBS elements, etc., can be temporary cost bearers from which cost should be settled to some permanent receivers.
    Cost elements / Cost element groups should be available as Master data before configuring settlement profile.
    To answer your latest query, there are 2 type of cost centers.
    Sender Cost Center - Against this, labor / internal activity price will be maintained in KP26. This cost center will be maintained in PM / PP work centers. While creating PM / PP orders, one of the work centers & activity types will be mentioned. Based on the KP26 entry for the combination of Activity type & Sender cost center, price will be picked & calculated according to work hours / labor hours maintained in PM / PP orders.
    Receiver Cost Center - Receiver cost center is the department / location cost center to which cost should be settled. Only receiver cost center will be maintained in settlement profile. Sender cost centers will be picked up automatically from work center.

  • How to check if a user exists in the system ?

    Dear Gurus,
    I want to check whether a user ID exists in the system after logon by using VBA. If the user ID exists, then I will update the user's information with external data by using the method user.change.
    When running below codes, error occurs and error msg is: "The persistent key for an business object instance of type USER has not been set. Cannot invoke method EXISTENCECHECK"
    How can I do to check the user ID existence ?
    Set oUser = oBAPICtrl.GetSapObject("user")
    oUser.ExistenceCheck "MyUserID", return:=oReturn
    Thanks and Regards,
    Bao Yan

    Mickey,
    I'm afraid I never did get this to work properly. However, in the way of all bad/good (delete as appropriate) programmers eveywhere I worked around this problem. I was using this code in Banner.asp to change the view based on the user group so if a given session variable was set a user would see a different view. It works fine with no slow down on the page and you should be able to adapt it to what you need.
    Hope this helps.
    Neville
    Note: Application variables are ones I have defined in config.xml.
    Code follows:
    <!--START:INC\common\getgroup.asp-->
    <% 'NAH 29/03/2004 ' 'This check the to see if the current user has the group in their membership that has been defined as the group to provide an alternative view of the portal.' 'The group variable is defined in the config.xml as "ALTVIEWGROUP"'
    'Do not do this is we have already matched the group'If Session("groupMatch") <> "1" and Session("groupMatch") <> "2" then
    Dim pGroup
    pGroup = Application("ALTVIEWGROUP") Set Session("groupMatch") = nothing
    Dim Plumtree
    Set Plumtree = Server.CreateObject("ADODB.Recordset") Plumtree.ActiveConnection = "Driver={SQL Server};Server=" & Application("DBSERVER") & ";Database=" & Application("PLUMTREEDB") & ";" Plumtree.Source = "SELECT GROUPID FROM " & Application("PLUMTREEDBUSER") & ".PTGROUPMEMBERSHIP WHERE (USERID = " & strUserID & ") AND (GROUPID = " & pGroup & ")" Plumtree.CursorType = 3 Plumtree.CursorLocation = 2 Plumtree.LockType = 1 Plumtree.Open()
    'If there are records we should have a match otherwise set the session varible to no match.' If Plumtree.EOF then Session("groupMatch") = "2" Else 'By getting here the user should have the matching group but complete one final check to make sure' If cInt(Plumtree.Fields.Item("GROUPID").Value) = cInt(pGroup) then Session("groupMatch") = "1" Else Session("groupMatch") = "2" End If
    End If
    Plumtree.Close() Set Plumtree = Nothing
    End if%><!--END:INC\common\getgroup.asp-->

  • How to check if the path exists and if not, create it

    I'm trying to check if the path given by the user already exists. In case it doesn't, I'd like to create a folder with name given in the same directory.
    Let's say path_1: "C:\folder1" and path_2: "C:\folder2", and suppose that folder1 exists but folder2 doesn't. Then if the path given by the user is the path_1, then ok, nothing happens, but if it is the path_2, then the programm should realize that it doesn't exist in C:\ and should ask you whether you want to create it or not.
    I know how to do that for files, but not for folders!
    Thanks in advance

    hi guys,
    i`m new at this so im gonne prob. ask a noob`s question...
    i have the same issue as in the title.
    but when i run :
                                              int a,b,c,d,folderexist=-1;
                                             switch (event)
                                                       case EVENT_COMMIT:
                                                                                 GetCtrlVal (panelHandle, PANEL_NAME, name);
                                                                                 folderexist = GetFileAttrs (name, &a, &b, &c, &d);
                                                                                 if (folderexist==-1)
                                                                                           MakeDir (name);
                                                                                           sprintf...........
                                                                                 else.......
    if the folder do exists it works perfectly.
    if it doesnt - it breaks the run and gives me the message :
                          NON-FATAL RUN-TIME ERROR: "NewScap.c", line 317, col 27, thread id 0x00001B98: Library function error (return value == -1 [0xffffffff]).
    (and mark the getfileattrs line in blue)
    and when i check the "folderexits" value it shows 2!? not 1 not 0 not even -1, but 2...
    can somone please help ?
    thanks 
    Adi.

  • Checks users Exists in user group or not?

    Hi All,
    bool userExsists = SPContext.Current.Web.CurrentUser.Groups.Cast<SPGroup>().Any(g => g.Name.ToLower() == "groupname".ToLower());
    Is there ay alternative for findings that user is in group or not? Is it best way to achieve this?

    Hi,
    To check if a user exists in user group, please use the code below:
    string userName = "contoso\\admin";//your user account
    string groupName = "SP Members";// your user group
    using (SPSite spSite = new SPSite("http://sp")) // your site collection URL
    using (SPWeb spWeb = spSite.OpenWeb())
    SPUser user = spWeb.EnsureUser(userName);
    if (user.Groups.Cast<SPGroup>().Any(g => g.Name.Equals(groupName)))
    Console.WriteLine("User " + userName + " is a member of group " + groupName);
    else
    Console.WriteLine("User " + userName + " is NOT a member of group " + groupName);
    Or you can use PowerShell command below:
    $w = get-spweb http://my
    $gs = $w.SiteGroups
    $g = $gs[12]
    $user = $g.Users.GetByEmail("[email protected]")
    if($user -eq $null){write-host "User Not Found"}
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Need user exist?

    Hello, 
    Need user exist in RFFOEDI1 to create custom segment to populate some  fileds.
    If any one done this type requirement please let me know the user exist.
    Thanks,
    chinna

    Hi,
    This way you can find any user exit:
    1. Go to the program 'RFFOEDI1'. Get the package name from the program attributes.
    2. Go to tcode 'SMOD'
    3. Enter the package name of that program and execute.
    You will get the list of exits available for that package. Based on its description and documentation of each exit you can identify which exit will be useful for you.
    Regards,
    Saba

  • Check to disallow user to create PO by PM order if PM order is not released

    Hi SAP Gurus ,
    Can we put such check/validation that user should not allowed to create Purchase order based on PM order , if PM order is not Released .
    We received such CR from business ( Client )
    Waiting for reply .
    Chandan Prayag

    Hi,
    this can be done through User exit or BADI.
    Rgds,
    Saurabh

  • Limiting Check Boxes by User

    How can I limit the number of check boxes a user can select?  I created the form in Acrobat XI, there are 20 check boxes and are named "chkBox0 thru chkBox20."

    Here's a sample form that demonstrates one way to do this: https://workspaces.acrobat.com/?d=j-aUbc3YTz1uu8Jx0LvzHg
    Each check box calls the same function that's defined in a document-level JavaScript. You'll have to study it a bit to see how it works.
    Here's the document-level function:
    function limitCheckNumber(prefix, lower, upper, max) {
        // Initialize the selected check box count
        var count = 0;
        // Loop through the check boxes to see if the limit has been exceeded
        for (var i = lower; i < upper + 1; i += 1) {
            // Increment the counter if the current check box is selected
            if (getField(prefix + "." + i).value !== "Off") count += 1;
            // If the count exceeds the limit, deselect the check box that was just selected
            // and alert the user
            if (count > max) {
                event.target.value = "Off";
                app.alert("A maximum of " + max + " check boxes can be selected", 3);
                break;
    And here is the Mouse Up script for each check box:
    limitCheckNumber("check", 0, 9, 4);
    The check boxes are named: check.0, check.1,...,check.9, and it's limited to 4 check boxes max selected at one time.

  • Checking user exist on resource or not before creating it

    Hi Friend,
    I have requirement in which I need to check user id exist in resource or not before creating it.
    I can not testUser as it checks user in LH not in resource. I need to see if my user is existing in particular resource.
    Can some one throw some light on it?
    Thx

    Hi Mark,
    I am creating user from resource A to resource B during active sync, but when I am creating user in recource B , i will generate unique ID and will check if any other user with same ID is existing or not.
    Thx

  • Error when creating a user - IAM-3010183 : An error occurred while checking if a user already exists with the Common Name generated.

    Error when creating a user - IAM-3010183 : An error occurred while checking if a user already exists with the Common Name generated.

    in OIM 11g R2
    Message was edited by: 2b3c0737-074f-48d0-a760-e24e3ed9a37c

  • Checking to see whether a user exists in a Windows Active Directory

    I have a little java applet that has to run through a large list of users, and for one of its tasks, it has to check to see whether that user exists. Mostly this is the same as running with local users, with the one exception that I can't just check to see if a home directory exists.
    Right now I am checking the return code from "net user <username>", but executing this program for every potential user is extremely slow.
    Are any java facilities to deal with users on the local system? If not, does anyone else have any suggestions?
    Also, a note for any responses- I'm using java to get around the lack of any easy way to set up a good scripting environment on Windows. I have a completed tool, and I don't want to rewrite it.

    <sarcasm>
    I seem to remember this service - what's it called? Ah, Google. Yes.
    </sarcasm>
    Try http://www.google.com/search?q=java+active+directory+query

  • Use Powershell to check whether and AD user exists

    We're trying to clean up roaming profile folders, and as part of the task I need to check whether the user actually exists in AD.  I have tried 3 different methods and so far none of them work.
    Either the empty result of the search doesn't equal $null (e.g. If ($objUser -eq $null) resolves to false) or Powershell crashes (like when I try to run that If statement).  So is there an AD User equivalent to Test-Path?
    RF

    I should add, if you want to use PowerShell filter syntax, you can use:
    $Name
    = "jsmith"
    $User = Get-ADUser
    -Filter {sAMAccountName
    -eq $Name}
    If ($User
    -eq $Null) {"User does not exist in AD"}
    Else {"User found in AD"}
    And if you only have PowerShell V1, you can use the following:
    $Name =
    "jsmith"
    $Searcher =
    [ADSISearcher]"(sAMAccountName=$Name)"
    $Results =
    $Searcher.FindOne()
    If ($Results
    -eq $Null) {"Users does not exist in AD"}
    Else {"User found in AD"}
    In all cases I assume you are checking the "pre-Windows 2000 logon" name, not the Common Name (the value of the cn attribute, which does not uniquely identify the object in AD).
    Richard Mueller - MVP Directory Services

  • Is it possible to check if a user has a device font before using it?

    It's all in the title really. I was hoping there might be a way to check if the user had a certain font already installed on there computer to try and save loading the font at runtime when not needed. Is this possible with Flex4 and the new TLF?
    Thanks
    Ollie

    Font.enumerateFonts(true); will give you an array of device and embedded fonts.

  • How to check if function module exist

    Hi All!
    Does anyone know how to check if function module, which name is provided by the user, exists?
    I have to execute a function but when user provides a incrrect name - i receive a short dump. I would like to chceck if this function exists before execution and if not - warn user with message box.
    Thanks
    Tomek

    REPORT z_tmtest MESSAGE-ID zz.
    PARAMETER: a_fname  LIKE tfdir-funcname.
    PERFORM test_fun_exist USING a_fname.
          FORM test_fun_exist                                           *
    Test FM Exists
    FORM test_fun_exist USING f_funcname  LIKE tfdir-funcname.
      CALL FUNCTION 'OM_FUNC_MODULE_EXIST'
           EXPORTING
                function_module = f_funcname
           EXCEPTIONS
                not_existent    = 1
                OTHERS          = 2.
      IF sy-subrc <> 0.
        MESSAGE e001.
      ENDIF.
    ENDFORM.

Maybe you are looking for

  • Challenges in Implementing Inter Organisation BPM

    Hi all, What are the Technical and Business challenges for implementing collaborative BPM across the value chain? What critical aspects need be considered for implementing Cross Organisational BPM? Thank you, Regards, Ganesh Sawant Edited by: ganesh

  • What program can l use to make cards, presentation cards in my Mac? something equivalent to Corel Draw from Windows

    I used to use Corel Draw from Windows to make cards, birthday cards, invitation cards, etc. Now l want do the same in my Macbook pro, people told me Mac has something equal to Corel Draw. I wonder which program l can use to do that.

  • My nano is in recovery mode

    I have tried to recovery in itunes and restore it but it keeps giving me the error message the message that it cant connect. I am connected to the internet but it says it cant find it. I dont know whats wrong. I did see another message about changing

  • Custom controller init & arguments

    Hi there, i would like to know if it is possible to pass arguments to a custom control constructor that are not properties/events/aggregation/etc. I already read a lot of documentation as UI Controller without finding a way to do this. I tried (and f

  • Some matched music is not showing on iOS devices!

    I subscribed to and set up iTunes match this morning on my iMac. All seems to have gone well, everything matched and the upload of about 300 songs is about halfway through. But, on my iPhone and iPad, some music isn't appearing, despite it showing as