How to retrieve user custom attributes in OID programmatically

Hi,
I created a custom attribute named "location" in OID. Could someone give indication/portion of code showing how to retrieve this custom attribute "location" of a user programmatically?
For the moment, I just found sample code (using oracle.ldap.*) showing how to retrieve "uid" attribute of a user programmatically. I tried to get me inspired of this portion of code, but never succeed.
Thanks a lot for any help.
Jeff

Use below code to get all attributes in user profile including UDF.
OIMInternalClient objOimInternalClient = null;
User user = null;
          UserManager usrService = null;
objOimInternalClient = new OIMInternalClient();
          if (objOimInternalClient != null) {
                    try {
                         objOimInternalClient.loginAsAdmin();
                         usrService = objOimInternalClient
                                   .getService(UserManager.class);
                         user = usrService.getDetails("usr_key", strUserKey, null);
                         endDate = (Date) user.getAttribute("End Date");
                    } catch (Exception e) {
                         e.printStackTrace();
                    } finally {
                         if (objOimInternalClient != null)
                              objOimInternalClient.logout();
                         if (user != null)
                              user = null;
                         if (usrService != null)
                              usrService = null;
In order to see all UDF's in User profile, please create Authorization Policy.

Similar Messages

  • How to retrieve user defined attributes in Prepopulating a request dataset

    Hi,
    I have created couple of user defined attributes in user profile.
    And I am tryting to develop a prepopulate adapter in a request dataset for a resource. I need to prepopulate request dataset based on the values of above said user defined attributes.
    I tried to use tcResultSet result=UserOppsIntf.getSelfProfile(); in my pre-populate adapter but it is giving me only the following attributes and it is not giving any of my user defined attributes.
    Users.Manager Key
    Users.Manager Login
    Users.Manager First Name
    Users.Manager Last Name
    Users.Password Warning Date
    usr_locale
    Users.Key
    Users.Password Expired
    Users.Middle Name
    Users.User ID
    Users.Password Expiration Date
    Users.Status
    Users.Password Warned
    Users.Email
    Telephone Number
    Users.Display Name
    usr_timezone
    Users.Lock User
    Users.Last Name
    Users.First Name
    MEMBERTYPE
    If I use the code userData = usrService.getDetails("User Login", RequesterID, null); then I am getting only the following.
    Display Name:
    act_key:
    Full Name:
    usr_key:
    User Login:
    Last Name:
    First Name:
    Please let me know how to retrieve all of user defined attribute values in prepopulate adapter for a request dataset.

    Use below code to get all attributes in user profile including UDF.
    OIMInternalClient objOimInternalClient = null;
    User user = null;
              UserManager usrService = null;
    objOimInternalClient = new OIMInternalClient();
              if (objOimInternalClient != null) {
                        try {
                             objOimInternalClient.loginAsAdmin();
                             usrService = objOimInternalClient
                                       .getService(UserManager.class);
                             user = usrService.getDetails("usr_key", strUserKey, null);
                             endDate = (Date) user.getAttribute("End Date");
                        } catch (Exception e) {
                             e.printStackTrace();
                        } finally {
                             if (objOimInternalClient != null)
                                  objOimInternalClient.logout();
                             if (user != null)
                                  user = null;
                             if (usrService != null)
                                  usrService = null;
    In order to see all UDF's in User profile, please create Authorization Policy.

  • How can i add custom attributes to a new Class Object using the API ?

    Hello everyone,
    Here is my problem. I just created a subclass of Document using the API (not XML), by creating a ClassObjectDefinition and a ClassObject. Here is the code :
    // doc is an instance of Document
    ClassObject co = doc.getClassObject();
    ClassObjectDefinition cod = new ClassObjectDefinition(ifsSession);
    cod.setSuperclass(co);
    cod.setSuperclassName(co.getName());
    cod.setName("MYDocument");
    ClassObject c = (ClassObject)ifsSession.createSchemaObject(cod);
    Everything seems to be OK since i can see the new class when i use ifsmgr. But my question is : how can i add custom attributes to this new class ? Here is what i tried :
    AttributeDefinition value = new AttributeDefinition(ifsSession);
    value.setAttribute("FOO", AttributeValue.newAttributeValue("bar"));
    c.addAttribute(value);
    But i got the following error message :
    oracle.ifs.common.IfsException: IFS-30002: Unable to create new LibraryObject
    java.sql.SQLException: ORA-01400: impossible d'insirer NULL dans ("IFSSYS"."ODM_ATTRIBUTE"."DATATYPE")
    oracle.ifs.server.S_LibraryObjectData oracle.ifs.beans.LibrarySession.DMNewSchemaObject(oracle.ifs.server.S_LibraryObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.NewSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.createSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    void fr.sword.ifs.GestionDocument.IFSDocument.createDocument(java.lang.String)
    void fr.sword.ifs.GestionDocument.IFSDocument.main(java.lang.String[])
    So, what am i doing wrong ?
    More generally, are we restricted in the types of the attributes ? (for example, would it be possible to add an attribute that would be an inputStream ? Or an object that i have already created ?).
    Any help would be appreciated. Thanks in advance.
    Guillaume
    PS : i'm using Oracle iFS 1.1.9 on NT4 SP6 and Oracle 8.1.7
    null

    Hi Guillaume,
    you're welcome. Don't know exactly, but assume that ATTRIBUTEDATATYPE_UNKNOWN
    is used to check for erronous cases only
    and it shouldn't be used otherwise.
    Creating your own objects could be simply done via
    ClassObject ifsClassObject;
    DocumentDefinition ifsDocDef = new DocumentDefinition(ifsSession);
    // get class object for my very own document
    ifsClassObject = ClassObject.getClassObjectFromLabel(ifsSession, "MYDOCUMENT");
    // set the class for the document i'd like to create
    ifsDocDef.setClassObject(ifsClassObject);
    // set attributes and content for the document...
    ifsDocDef.setAttribute("MYFOO_ATTRIBUTE",....);
    ifsDocDef.setContent("This is the content of my document");
    // create the document...
    PublicObject doc = ifsSession.createPublicObject(ifsDocDef);
    null

  • How to add a custom attribute to an entry?

    I need to store a person's social security number in the directory.
    I haven't found any appropriate standard attribute for such purpose (is there any?), so I decided to create a new one.
    I've written a method:
    public void setAttribute(String entryDN, String attrName, String attrValue)
    throws LDAPException, UnsupportedEncodingException
    LDAPConnection lc = new LDAPConnection();
    lc.connect(ldapHost, ldapPort);
    lc.bind(ldapVersion, loginDN, password.getBytes("UTF8"));
    LDAPAttribute attribute = new LDAPAttribute(attrName, attrValue);
    LDAPModification modification
    = new LDAPModification(LDAPModification.ADD, attribute);
    lc.modify(entryDN, modification);
    lc.disconnect();
    When the method is called
    ldapManager.setAttribute("cn=TheUserName,cn=Users,dc=server,dc=domain,dc=com", "_custom", "TEST");
    the following exception is thrown:
    LDAPException: Undefined Attribute Type (17) Undefined Attribute Type
    LDAPException: Server Message: Attribute _custom is not supported in schema.
    LDAPException: Matched DN:
         at com.novell.ldap.LDAPResponse.getResultException(Unknown Source)
         at com.novell.ldap.LDAPResponse.chkResultCode(Unknown Source)
         at com.novell.ldap.LDAPConnection.chkResultCode(Unknown Source)
         at com.novell.ldap.LDAPConnection.modify(Unknown Source)
         at com.novell.ldap.LDAPConnection.modify(Unknown Source)
         at com.novell.ldap.LDAPConnection.modify(Unknown Source)
         at lv.alise.eliepaja.ldap.LdapManager.setAttribute(LdapManager.java:156)
         at lv.alise.eliepaja.ldap.LdapManager.main(LdapManager.java:178)
    Exception in thread "main" Process exited with exit code 1.
    How could I solve the issue?

    Hi,
    You need to check for a few things in your OID :
    1. Your custom attribute should be present in the Schema.
    2. The attribute should be grouped in an ObjectClass.
    3. The ObjectClass should be put in the Entry you wish to modify.
    4. You can then store a value ( or values ) against the attribute.
    You can do steps 1, 2 & 3 either programatically or manually.
    I hope this helps.
    Regards,
    Sandeep

  • How to add a custom attributes in Oracle HTML Quotes page?

    Hi,
    Could someone advice on the best way to add a custom attribute in Oracle HTML Sales Quoting page.
    As this page is not an OA page, we are not able to use the concept of View Objects using AK Developer.
    Thanks,
    Arathi

    I have a requirement from our end users that all of them requires a shortcut button in toolbar for submitting a request instead of going the normal way in order to submit a single request.
    please can any one help me out in solving this query.Any reason you want to use a shortcut rather than using (Requests > Submit) window?
    You can use "FND_REQUEST.SUBMIT_REQUEST" API -- https://forums.oracle.com/forums/search.jspa?threadID=&q=FND_REQUEST.SUBMIT_REQUEST&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    How To Submit A Concurrent Request Set Using Fnd_Request.Submit_Request [ID 382791.1]
    How To Set ORG_ID When Submitting A Concurrent Request Using FND_REQUEST.SUBMIT_REQUEST in Release 12 [ID 1383266.1]
    Thanks,
    Hussein

  • How to retrieve user name from a given Subject?

    I am in a situation where I need to retrieve user name from the Subject that is populated when user logs in. I have the active Subject and I do following to get the principals in the subject and iterate through them:
    Set principals = subject.getPrincipals();
    Iterator ite = principals.iterator();
    while (ite.hasNext()) {
    Principal prin = (Principal)ite.next();
    String name = prin.getName();
    But this contains all the principals, including user name, roles, password, etc. How do I programmatically determine which one is user name?

    Don't you have different principal types? I am making a jaas module and I have different principals for roles, groups etc. I think of principals as attributes, the type in the attribute name and the principal name is the attribute value.
    To get all the principals of the type SomePrincipal, you can use:
    Set principals = subject.getPrincipals(SomePrincipal.class)
    You can also take som principal an test wether it is an instance of som type:
    if (Principal p instanceof SomePrincipal){..}
    An other solution which might be better if you have many different attributes is to store both attribute name and value in the name of the principal.
    If "mark" is a username the principal name will be "username:mark" el.
    Then it will be easy to find the username.

  • How to retrieve  users info

    does anyone Knows how to retrieve the users info.
    for example if I want to create a LOV that contains the emails of all the users.
    thanks in advance.

    Retrieve them using and LDAP Search via DBMS_LDAP. Or you could cheat and search the ODS schema tables directly which contain all of the LDAP info. See the DS_ATTRSTORE table. Pull all attributes with a name like "mail"

  • How to register User custom field using PHP?

    Hi!
    I am looking for a way to share user specific data between connected users. For example, all participants should know each other IDs(our own system IDs, not LCCS).
    User's custom fields looks the best solution for this, but I can't find a way to register one using PHP, while creating room.
    How to register User's  custom field using PHP? Or may be there are better solution to make such things?

    Got it, just need to add new node to UserManager collection.
    const USER_MANAGER_COLLECTION = 'UserManager';
    static private $USER_MANAGER_CUSTOM_FIELD_CONFIGURATION = array(
       'accessModel'=>self::ROLE_VIEWER,
       'publishModel'=>self::ROLE_VIEWER,
       'persistItems'=>true,
       'modifyAnyItem'=>false,
       'userDependentItems'=>true,
       'sessionDependentItems'=>false,
       'itemStorageScheme'=>self::STORAGE_SCHEME_MANUAL,
       'allowPrivateMessages'=>true,
       'lazySubscription'=>false,
       'p2pDataMessaging'=>false
    const USER_INVITE_ID_CUSTOM_FIELD = 'inviteId';
    static private function createUserManagerCustomFields($room){
       $account = self::init();
       $collection = self::USER_MANAGER_COLLECTION;
       $account->subscribeCollection($room, $collection);
       $account->createNode($room, $collection, self::USER_INVITE_ID_CUSTOM_FIELD, self::$USER_MANAGER_CUSTOM_FIELD_CONFIGURATION);

  • How to create a new attribute in OID and auto-populate it during sync from AD

    Hi,
          I'm new to OID and we are planning to set up AD to OID sync and we need to create an extra attribute in OID that we do not have currently in AD. We need to concat 4 attributes with "." in between and populate this new attribute.
    If anyone has done something like this, can you please give me the steps involved and/or any examples?
    Thank you

    I think you need to create a custom plugin to create the value of new attribute and populate it, may be post plugin in OID.
    Java Server Plug-in Developer's Reference

  • How to retrieve User Session in Xcelsius 2008

    Hi
    I am currently building dashboards with some securities on display. The dashboards have to show different views (e.g. Manager view with full access of data and Employee view with partial access of data) for different users, and I expect to get the user information (particularly user name) from the BO user session for making the security decision.
    I can successfully retrieve the user session from Dashboard [url button] to JSP using openDocument (by looking at the cookies), but it seems that I have no way to import the data back to the Dashboard. When I am using Data Manager > XML Data (With XML datasource is a JSP file), it seems the user session cannot be retrieved.
    So, my question is, how to retrieve the user Name in Xcelsius 2008 ?
    Any help is greatly appreciated.

    Hi,
    we did also some research activities about Xcelsius. We are passing the user name to the Xcelsius via Webservice. Based on the portal integration, you do not have to care about the authentication to the Webservice. This does the Enterprise Portal for you. For the integration, we are currently using a BSP solution. In this way, you can get the user name very simple:
    sy-uname
    You can put into the Webservice or provide it as Flash Variable to the Xcelsius in the <OBJECT> tag.
    Take care,
    Thomas

  • How to retrieve User Description for a particular MDM User from Console ?

    In my Application i  have to retrieve User Descripton(a field) for the MDM Users  from Console. I am using MDM Java Api 1(MDM4j) in my application. Is there any way i can retrieve MDM User Description from Console without using MDM Admin API?

    Hi Namrata,
    Sorry, I have a different perspective from you (I don't work with the Java API). So, you can ignore what I said about the protocols. That's lower-level than what you would care about.
    The correct thing to do is to use the Admin API to get the users, as you are doing. If you have to log in twice, it might be because you're using the old Java API.
    Please verify that you're using these packages:
    mdm-core.jar, mdm-common.jar, mdm-protocol.jar, mdm-data.jar, mdm-admin.jar
    versus the old API, which was called mdm4.jar.
    Thanks,
    Cleopatra

  • How to retrieve value of attribute using xPath ?

    Hello experts,
    I have a following xml chunk
    <image file="/articles/engineering/boxerengine/preview_282x160.jpg">
    <tout name="copyright"></tout>
    <tout name="license"></tout>
    <tout name="photographer"></tout>
    <tout name="description"></tout>
    </image>
    I want to retrieve value of attribute file from absolute node image.
    I tried using xpath='/image/@file' It gives output as file="/articles/engineering/boxerengine/preview_282x160.jpg"
    I just want value "/articles/engineering/boxerengine/preview_282x160.jpg"
    I tried using xpath='/image/@file/text()' . It does not work
    Following is the java code. I am using XOM parser.
    java code :
    Builder parser = new Builder();
    Document doc = parser.build(xmlFile);
    Nodes titles = doc.query(xPath);
    //xpath = ''/image/@file/text()"     
    for (int i = 0; i < titles.size(); i++) {
    strChunk = strChunk.append(titles.get(i).toXML());     
    return strChunk.toString();
    Please help.
    Thanks,
    Sandeep Parmar

    Hi Sandeep,
    Using XPath and XPathExpression you can evaluate XPath queries on Document. have a look at code given bellow:
    // Building Document from XML File
    org.w3c.dom.Document imageDoc = builder.parse(xmlFile);
    // getting new instance of XPath
    javax.xml.xpath.XPath xpath = javax.xml.xpath.XPathFactory.newInstance().newXPath();
    // Building XPathExpression by compiling XPath query
    javax.xml.xpath.XPathExpression xPathExp = xpath.compile("/image/@file");
    // Evaluting XPath Expression on Document
    String imagePath = (String) xPathExp.evaluate(imageDoc, javax.xml.xpath.XPathConstants.STRING);
    // Priting image path it will print : "/articles/engineering/boxerengine/preview_282x160.jpg", if you try with data given in your post.
    System.out.println(imagePath); Hope this will help.
    thanks,
    Tejas Purohit

  • How to retrieve the call logs of iphone programmatically??

    Hi
    how do I retrieve the call logs of iphone programmatically ?? I have searched Address book API no help there./....

    You can view and download call history with PhoneView.
    Dave M.
    MacOSG Founder/Ambassador  An Apple User Group  iTunes: MacOSG Podcast
    Creator of 'Mac611 - Mobile Mac Support' (designed exclusively for an iPhone/iPod touch)

  • How to migrate custom attribute from OID to RHDS

    Hello!
    I am migrting my server from Oracle Internet Directory (OID) to Red Hat Directory Server (RHDS 8.1). I need to export the schema containing custom objectclass and attributes. I also need to migrate the entries. Can anyone tell me how can I do these exporting and importing task?
    I also have orclaci attribute set for groups. Does RHDS support the attribute?

    Hi Rajesh,
    You can also do it like this.
    run dsc <program name> => Copy the output to a .txt file and in the end of this txt file after "END" insert a enter.
    upload this file to physical location of a oracle directory(ensure that the user has access to this directory).
    Now from olap worksheet run
    infile <txt file name>;upd;commit;
    Thanks
    Brijesh

  • How to retrieve only LDAP attributes

    Any way to retrieve only the available LDAP attributes?
    I want to display all the available LDAP attributes on the UI (like sn, cn, etc.) and let user select which ones he want to retrieve.
    Thanks.

    This would be a function of building an ldapsearch in your code and stating the attributes you want returned as input from the user. Its better to know up front what attributes are available from the ldap based on access rights, and make that static, instead of retrieving them everytime someone opens a web page. If you run an ldapsearch and state the attributes you want returned you will only get those back.

Maybe you are looking for