CSOM (Javascript) Inner join CAML query on 'User Information List'

I need to pull site user details like (email, display name, phone) from 'User information list' using a 'inner join' on a different list 'SiteOwners' where 'Contact' is a person or group field.
The result object is not returning the details from 'User Information List' though it returns details from 'SiteOwners' list
<script src="/_layouts/15/SP.runtime.js" type="text/javascript"></script>
<script src="/_layouts/15/SP.js" type="text/javascript"></script>
<script type='text/javascript'>
'use strict';
//$(document).ready(function() {
function abc() {
var context = SP.ClientContext.get_current();
var web =context.get_web();
var stownrlist = web.get_lists().getByTitle('SiteOwners');
var camlqry = new SP.CamlQuery();
camlqry.set_viewXml = "<View>" +
"<Query></Query>" +
"<ViewFields>" +
"<FieldRef Name='Title'/>" +
"<FieldRef Name='Contact'/>" +
"<FieldRef Name='UserName'/>" +
"<FieldRef Name='UserEMail'/>" +
"<FieldRef Name='UserMobilePhone'/>" +
"</ViewFields>" +
"<ProjectedFields>" +
"<Field Name='UserName' Type='Lookup' List='User Information List' ShowField='Name' />" +
"<Field Name='UserEMail' Type='Lookup' List='User Information List' ShowField='EMail' />" +
"<Field Name='UserMobilePhone' Type='Lookup' List='User Information List' ShowField='MobilePhone' />" +
"</ProjectedFields>" +
"<Joins>" +
"<Join Type='INNER' ListAlias='User Information List'>" +
"<Eq>" +
"<FieldRef Name='Contact' RefType='Id'/>" +
"<FieldRef List='User Information List' Name='ID'/>" +
"</Eq>" +
"</Join>" +
"</Joins>" +
"</View>";
debugger;
var stownritems = stownrlist.getItems(camlqry);
context.load(stownritems);//, 'Include(Title,Contact,UserName,UserEMail,UserMobilePhone)');
context.executeQueryAsync(
Function.createDelegate(this, function () {
debugger;
var stownenm = stownritems.getEnumerator();
while (stownenm.moveNext()) {
var userid, loginname,email,name,mobilephone;
if (stownenm.get_current().get_item('Contact') != null) {
userid = stownenm.get_current().get_item('Contact').get_lookupId();
loginname = stownenm.get_current().get_item('Contact').get_lookupValue();
email = stownenm.get_current().get_item('ows_UserEMail');
name = stownenm.get_current().get_item('UserName');
mobilephone = stownenm.get_current().get_item('UserMobilePhone');
}), function() {alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());});
</script>
Any suggestions / help please.
Sai

I identified the issue
"camlqry.set_viewXml"  is a method (camlqry.set_viewXml()) not a property (as apposed to C#).
The above should be like "camlqry.set_viewXml(querystring)" instead of "camlqry.set_viewXml =qrystring".
Sai

Similar Messages

  • How to Update Picture column in User Information List?

    Hi,
    The user updated his profile picture in mysite about 10 days ago. The updated picture is shown on his mysite but the same is not in sync with User Information List. The 2 timer job which takes care of the profile synchronization are scheduled as below:
    Profile Synchronization : hourly
    Quick Profile Synchronization : every 2 minutes
    And both the timer job status are shown as successful, yet the picture url is not updated.
    Can anyone kindly let me know is there any way to update the same manually.
    Please note that the version of SharEPoint is 2007 and Windows server 2003.
    Thanks in Advance.

    Hi Sheetal Lomate,
    It is correct to check the profile synchronization jobs to make sure profile information syncs between user profiles and user information list.
    If it is still not synced, please use the following stsadm command:
    stsadm –o sync –listolddatabases <x number of days>
    If one or more content databases show up in this list, clean up the list, they can be added to the list again:
    stsadm –o sync –deleteolddatabases <x number of days>
    Related reference:
    User Profiles and User Informtation list synchronization:
    http://www.sharepointchick.com/archive/2009/06/17/user-profiles-and-the-user-information-list-or-userinfo-table.aspx
    Thanks,
    Qiao
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Qiao Wei
    TechNet Community Support

  • User profile service not updating 'Title' in user information list

    Hi,
    In our SharePoint farm, following two user profile sync timer jobs are successfully running but not updating the 'Title' in the hidden user information list.
    User Profile to SharePoint Full Synchronization
    User Profile to SharePoint Quick Synchronization.
    Can someone point me to the right direction? Please note that I don't want to use powershell script shown here to update the 'Title' in the user information list -
    http://blog.falchionconsulting.com/index.php/2011/12/updating-sharepoint-2010-user-information/.
    Thanks,
    Manvir
    Manvir

    Hi,
    There are two jobs, User Profile to SharePoint Quick Sync and User Profile to SharePoint Full Sync, that synchronize the User Profile database information with the user information list. Sometimes this stops working (properly) and in that case
    you need to run:
    Stsadm.exe –o sync –listolddatabases 0
    Stsadm.exe –o sync –deleteolddatabases 0
    The first command will display all the databases and when they have been sync’d last.
    The second command will delete the records corresponding to those databases (it doesn't delete databases/end user data).
    Anyways, running this will basically tell the timer jobs that they have never sync’d and force them to carry on as if it’s the first time.
    Go to Central Admin and fire off the User Profile to SharePoint Full Synchronization
    job.
    For detailed information, refer to the following article:
    https://donalconlon.wordpress.com/2012/03/02/sharepoint-user-information-list-is-not-being-updated/
    Best Regards,
    Lisa Chen
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Validate "work e-mail" from user information list --give me wrong result

    How can I validate the user "work email" from User Information List is working
    properly?
    I am following this >> http://social.msdn.microsoft.com/Forums/sharepoint/en-US/e4d41f77-c7e4-40ef-b85f-de7f972f2a3f/allow-submitter-see-only-the-items-that-are-relevant-to-him-in-drop-down-list?forum=sharepointcustomizationprevious#4d63b721-7acb-463a-b578-87eb1d72b5f1
    But instead to get the correct work email I am getting >>domain \usernamedomain
    \username domain \username  (example: americas\admin_andress_belloamericas\admin_andress_belloamericas\admin_andress_bello)  
    CRISTINA&amp;amp MICROSOFT Forum

    Hi,
    How did you validate the work e-mail?
    I recommend to set another text field to get the email of the user from User Information List and then use the text field for validation.
    Could you please provide an example of your requirement for reproducing this issue?
    Thanks,
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

  • Sharepoint 2010 Content Deployemnt Job issue with duplicate fields in User information List

    Hi friends,
    I am facing below issue with the content deployment job.
    It was working earlier. But now since from couple of days all the content deployment jobs in production environment are failing with below error.
    Field name already exists. The name used for this field is already used by another field in the list. Select another name and try again.
    ObjectName="User Information List".
    When I check the fields in User information list in targeted site, I found couple of columns are dupicate like "ask me about",first name","Last name" etc.
    Do i Need to drop target site collection or recreate with fresh content deployment job.
    Please suggest.
    Please help .
    Regards
    Subrat

    Hi,
    According to your post, my understanding is that you got duplicate field error.
    Based on the error message, you can try to use the following code sample to remove duplicate records, and check whether it works:
    http://social.msdn.microsoft.com/Forums/en-US/sharepointgeneralprevious/thread/41ee04bd-91fb-4bf9-932a-bac42c56c357
    Here is a similar issue, you can also use the ‘RemoveDuplicateColumn64’ provided:
    http://sharepointsurfer.wordpress.com/2012/04/27/how-to-fix-publishing-site-content-deployment-error-duplicate-first-name-column/
    What’s more, as you had said, you can recreate a site with a fresh deployment job.
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to add user information list in site page using out of box

    Hi,
        Kindly suggest me any solutions or reference links regarding adding user information list in one of the site pages using out of box.
    Thanks
    Razvi444

    Hello Razvi444,
    it is not clear what you are trying to accomplish, but for your information User Information List could be find under <your_site>/_layouts/15/people.aspx?MembershipGroupId=0. If you would
    like to display all user on the page you need to develop a custom web part and using the aforementioned URL all user could be displayed on your page.
    Or you could also edit the page and insert a link (/_layouts/15/people.aspx?MembershipGroupId=0), set a description. SharePoint will name it people.aspx. After that you could "Edit Source" and rename it accordingly.
    Let me know if this one is helpful.
    Enjoy!

  • Sharepoint 2010: user information list Vs user profile

    I wrote code for getting user details based on username. I am fetching data from user profile using user profile service. But recently I came to know about "user information list" which stores same data as that of user profile.
    So, My question is which will be better choice : user profile service OR user information list to get user information ?

    User Information list has limitation, firstly its hidden, it can be viewed only administrators.
    Also you will face issue when you migrate your application to SharePoint 2013.
    If you want quick way of know who has permissions you can use this list, but sometime you may end up with outdated user profile(properties) information. 
    Better try to use User profile service wherever possible.
    there is another discussion on this topic here -
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/759d3c83-3fed-4bfc-a591-e88ca40e9407/sharepoint-user-information-list
    reference-http://www.sharepointchick.com/archive/2009/06/17/user-profiles-and-the-user-information-list-or-userinfo-table.aspx
    MCITP: SharePoint 2010 Administrator
    MCTS - MOSS 2007 Configuring, .NET 2.0
    | SharePoint Architect | Evangelist |
    http://www.sharepointdeveloper.in/
    http://ramakrishnaraja.blogspot.com/

  • How to do an INNER JOIN sub-query?

    Can't seem to find anything that would help me out with this.
    My prototype query goes like this but its giving me a ORA-00905: missing keyword
    SELECT Poker_Site.site_name, bonus.sign_up_bonus
         FROM poker_site
         INNER JOIN bonus
         WHERE Poker_site.site_name = 'Poker Stars'
         ON Poker_Site.site_name = bonus.site_name;

    INNER JOIN join must be immediately followed by ON and only then by WHERE:
    SELECT Poker_Site.site_name, bonus.sign_up_bonus
    FROM poker_site
    INNER JOIN bonus
    ON Poker_Site.site_name = bonus.site_name
    WHERE Poker_site.site_name = 'Poker Stars';SY.

  • Inner Join Select query

    hello all,
    Below is a inner join query
        SELECT aebeln aebelp apackno bzekkn b~ps_psp_pnr
                     FROM ( ( ekpo AS a INNER JOIN ekkn AS b
                              ON aebeln = bebeln
                              AND  aebelp = bebelp )
                             INNER JOIN prps AS c
                              ON bps_psp_pnr = cpspnr )
                     INTO TABLE t_wbspo
                      WHERE a~ebeln IN s_ebeln
                       AND  c~psphi IN s_psphi
                       AND  stufe = c_task.
    I want to modify this select and put one more join on ekkn-aufnr
    and aufk-afunr .
    Now for this i write the below code
      SELECT aebeln aebelp apackno bzekkn bps_psp_pnr baufnr
               FROM ( ( ( ekpo AS a INNER JOIN ekkn AS b
                        ON aebeln = bebeln
                        AND  aebelp = bebelp )
                       INNER JOIN prps AS c
                        ON bps_psp_pnr = cpspnr )
                        INNER JOIN aufk AS d
                        ON baufnr = daufnr )
               INTO TABLE t_wbspo
                WHERE a~ebeln IN s_ebeln
                 AND  c~psphi IN s_psphi
                 AND  d~aufnr IN s_aufnr
        AND  stufe = c_task.
    By the above way does it puts a join on ekkn-aufnr and aufk-aufnr ?
    Is the above way the right way to do it ?
    Please confirm
    regards

    Hello Bhanu,
    Do you face any performance issue? Query looks good now, further you can refer to following threads to know more on JOIN-
    Re: Inner join
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ec77446011d189700000e8322d00/frameset.htm
    Thank You,
    Nishikant Kumbhar.

  • CAML query performance for large lists

    I have a list with more than 10000 items. I am retrieving the items and displaying it in a RAD Grid on my page using CAML query. While retrieving the items, around 1000 records are retrieved due to filter. I have enabled paging in my grid and PageSize is
    set to 25. I have noticed that the load time of my page is very slow as it retrieves all the 1000 records at once.
    Is it possible to retrieve just 25 records for the first page on load. On click on the Next button or Page number it should retrieve the next set of 25 records for that particular page.
    I want to know if there is any way to link CAMl query paging with RAD grid paging
    Any code example would be greatly helpful.

    Hi,
    For pagination in SPListItem use the SPQuery.ListItemCollectionPosition property. 
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.listitemcollectionposition(v=office.15).aspx
    check the usefull urls
    http://omourad.blogspot.in/2009/07/paging-with-listitemcollectionposition.html
    http://www.anmolrehan-sharepointconsultant.com/2011/10/client-object-model-access-large-lists.html
    Anil

  • CAML Query to Sort SharePoint list items based on Modified date

    hi ,
    can we sort sharePoint list items based on 'Modified' column, the sorting should be done up to milliseconds level.
    currently i am using CAML query as below
    <OrderBy><FieldRef Name='Modified' Type='DateTime' IncludeTimeValue='TRUE' Ascending='False'/></OrderBy>but its not considering milliseconds while sorting.
    Thanks and Regards,
    venkatesh.

    Veda, thanks but I'm not really a hardcore C# coder.
    We found more elegant solution was to create a List View which returns all records that should be deleted, based on our own custom deletion criteria, and then create an very simple SSIS Package in Visual Studio using the
    Sharepoint Connectors for SSIS to delete all Sharepoint List Items returned from that List View. The Sharepoint Destination Connector has a delete operation.
    This worked for us and didn't require any coding.

  • How to create Global password and user information list in Linux

    Hi ,
    OS is : OEL, We have some requirement, we need to create global password and Users information, that location sould be accessable to all users, can any one guide me how to do it in Linux.

    Could you give us a little more details? Are u looking for something like a centralized authentication system? or....what exactly?
    kido

  • Javascript Caml Query join error

    Greetings, i'm getting an error in a caml query. I have 3 lists: Reuniones, Tareas, Gerencias. Tareas has a lookup to Reuniones (by ID) and Reuniones has a lookup to Gerencias (by Title). I'm trying to get all items in Tareas pointing to a Gerencias item
    "X", that is, all items in Tareas that has a Reuniones item with "X" as Gerencias lookup. Another requirement is that the Tareas item startdate has to be in a certain range.
    The problem is that my query is returning " Value does not fall within the expected range."
    My Query:
    <View>
    <Query>
    <Where>
    <And>
    <And>
    <Geq>
    <FieldRef Name='StartDate'></FieldRef><Value Type='DateTime'
    IncludeTimeValue='TRUE' StorageTZ='TRUE'>2014-02-01T02:00:00.000Z</Value>
    </Geq>
    <Leq>
    <FieldRef Name='StartDate'></FieldRef><Value Type='DateTime' IncludeTimeValue='TRUE' StorageTZ='TRUE'>2014-03-01T02:00:00.000Z</Value>
    </Leq>
    </And>
    <Eq>
    <FieldRef Name="Gerencia" List="Reuniones"/>
    <Value Type="Lookup">GerenciaExample</Value>
    </Eq>
    </And>
    </Where>
    </Query>
    <ViewFields>
    <FieldRef Name="Reunion" />
    <FieldRef Name="StartDate" />
    <FieldRef Name="Status" />
    </ViewFields>
    <ProjectedFields>
    <Field Name="Gerencia" Type="Lookup" List="Reuniones" ShowField="Gerencia" />
    </ProjectedFields>
    <Joins>
    <Join Type="Left" ListAlias="Reuniones">
    <Eq>
    <FieldRef Name="Reunion" RefType="Id" />
    <FieldRef List="Reuniones" Name="ID" />
    </Eq>
    </Join>
    </Joins>
    </View>

    Hi,
    Based on the error message, we can increase the value of the List View Lookup Threshold. 
    Go to the Central Admin > Application Management
    > Manage web applications>General Settings
    > Resource Throttling
    Here is a tool for you to check the query syntax.
    http://www.codeproject.com/Articles/458008/CAML-Query-Builder
    More information:
    List Join in SharePoint 2010 using CAML
    http://sujeewaediriweera.wordpress.com/2012/02/18/list-join-in-sharepoint-2010-using-caml/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Problem with caml query in javascript

    hi friends
    i am using caml query to retrieve single list item
    ReviewQuery.set_viewXml('<view><query><Where><Eq><FieldRef Name=\'PNet_x002d_No\' /><Value Type=\'Text\'>'+id123+'</Value></Eq></Where></query></view>');
    my problem is if quried id is available in list it is showing properly. but if queried item is not there then it is showing other item in it.

    Hi,
    I suggest you debug the code and check if the variable value is valid.
    Here is a code snippet for your reference :
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    _spBodyOnLoadFunctionNames.push("callCSOM");
    function callCSOM()
    $("#Button1").click(function()
    // Make sure the SharePoint script file 'sp.js' is loaded before your code runs.
    ExecuteOrDelayUntilScriptLoaded(sharePointReady, "sp.js");
    function sharePointReady()
    getListItems();
    var clientContext;
    var currentUser;
    var targetWeb;
    var message = "Web retrieved:";
    function getListItems()
    // Create an instance of the current context to return context information
    clientContext = SP.ClientContext.get_current();
    //Returns the list with the specified title from the collection
    var oList = clientContext.get_web().get_lists().getByTitle('list');
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml(‘<ViewFields><FieldRef Name='Title' /></ViewFields><Where> <Eq><FieldRef Name='Title' /><Value Type='Text'>12</Value></Eq> </Where>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);
    function onRequestSucceeded()
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext())
    //Gets the current element in the collection
    var oListItem = listItemEnumerator.get_current();
    message += '___'+'Title: ' + oListItem.get_item('Title');
    message += '___'+'ID: ' + oListItem.get_item('ID');
    message += '________________________________________________';
    $("#div1").text(message);
    //the delegate of the method that is called when the request is executed unsuccessfully
    function onRequestFailed(sender, args)
    alert('Error: ' + args.get_message());
    </script>
    <input id="Button1" type="button" value="Run Code"/>
    <p/>
    <div id="div1">test</div>
    Also, you can build CAML Query in the CAML Designer:
    http://www.camldesigner.com/
    Feel free to reply if the issue still exists.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Re field order in INNER JOIN

    Hi,
    I need a suggestion for improvement of my inner JOIN statement.
    internal table itab is of below type
    type: begin of ty_itab
            field a
            field b
            field c
            field d
            end of ty_itab
    I have to join two database table TABLE1 and TABLE2. Fields a and d are from TABLE2 and fields b and c are from TABLE 1.
    But in the internal table I must have the fields in the order fielda,b,c,d.
    Which of the below two options will be better for performance ? And why ?
    option 1:
    SELECT tab2~a
                  tab1~b
                  tab1~c
                  tab2~d into corresponding fields of itab from TABLE1 as tab1 and TABLE2 as tab2 on..........
    option2:
    SELECT tab1~b
                  tab1~c
                  tab2~a 
                  tab2~d into corresponding fields of itab from TABLE1 as tab1 and TABLE2 as tab2 on..........
    Thanks in advance...
    Best Regards
    Ananya Mukherjee
    Moderator message - Cross post locked
    Edited by: Rob Burbank on May 28, 2009 9:43 AM

    I am not satisfied with your two options. Because of following reason,
    1. First I want to know which one is master table and item table. Because in inner join select query you want to use master table as first and you want to use the item table as second.
    Example: 
    SELECT TAB2A  TAB1B TAB1C TAB2D
          INTO TABLE ITAB
        FROM <MASTER TABLE1> AS TAB1 INNER JOIN <ITEM TABLE2> AS TAB2 ON..........
    2. You should not use the INTO CORRESPONDING FIELDS OF ITAB. Instead of this you can change the field order in internal table or in select query.
    Example:
    Use following way
    TYPE: BEGIN OF TY_ITAB
                    FIELD A
                    FIELD B
                    FIELD C
                    FIELD D
               END OF TY_ITAB
    SELECT TAB2A  TAB1B TAB1C TAB2D
         INTO TABLE ITAB
       FROM <MASTER TABLE1> AS TAB1 INNER JOIN <ITEM TABLE2> AS TAB2 ON..........
    Or , Anyway you are going to use in program only. It will not affect your logic if change the field order in the internal table.
    TYPE: BEGIN OF TY_ITAB
                    FIELD B
                    FIELD C
                    FIELD A
                    FIELD D
              END OF TY_ITAB
    SELECT TAB1B  TAB1C  TAB2A  TAB2D
         INTO TABLE ITAB
       FROM <MASTER TABLE1> AS TAB1 INNER JOIN <ITEM TABLE2> AS TAB2 ON..........
    3. In inner join query, the order of Where condition also create the perform issue. Because in where condition maximum you try to use all the primary key from <MASTER TABLE1>  and <ITEM TABLE2> and field order in where condition should be same order in <MASTER TABLE1>  and  <ITEM TABLE>.
    This are the things you want to take care when you try to use INNER JOIN Query. If you have any clarification please let me know. I will try answer your Questions.
    Ravi.
    Edited by: RavivarmanP on May 28, 2009 6:55 PM

Maybe you are looking for

  • Can I use a 2nd monitor with my HP TouchSmart 310-1020?

    can I use a 2nd monitor with my HP TouchSmart 310-1020?

  • Help Mac/Unix Gurus - Boot Camp

    1. I created my BC partition for Vista x64. 2. Installed Vista x64 150g NTFS - Boots ok. 3. Under MAC Os 10.5.x - Vista x64/x86 Partition is shown as MS-Dos and Does not mount as read only. 4. Installed Paragon's MAC OS Ntfs - works. Now my main ques

  • Getting error after enabling php in httpd.conf

    Hi, I want to get php enable on the Apache web sever that is part of OS 10.6.1. I read the docs and uncommented the Load line for php in httpd.conf. Then I restarted the web server. Now when i try to access via Safari a phpinfo( ); command as part of

  • Adding date field in cv01n

    hye all,             i am very new in screen exit can plz anybody send any document or any screen shot or link for adding date field in cv01n(dms). thanks.

  • Organizing methods into classes...

    Does this sound acceptable/valid/good practice to other people? Note that this utility is still in the design phases and coding has not yet started. In a utility designed to transfer files to a storage server, I have four classes - one for pre-load p