function getAllUsers() { //alert('GetallUserExecuted..'); var ctx = new SP.ClientContext(appWebUrl);//Get the SharePoint Context object based upon the URL var appCtxSite = new SP.AppContextSite(ctx, hostWebUrl); var web = appCtxSite.get_web(); //Get the Site //Textbox value containing search term var searchTerm = $("[Id*='peoplePickerDiv_TopSpan_i:0#.f|membership|'][Id*='_ProcessedUser']")[0].id.split('|')[2].split('_')[0]; clientContext = new SP.ClientContext.get_current(); //Building Keyword query for the search var keywordQuery = new Microsoft.SharePoint.Client.Search.Query.KeywordQuery(ctx); keywordQuery.set_queryText(searchTerm); keywordQuery.set_sourceId("B09A7990-05EA-4AF9-81EF-EDFAB16C4E31"); keywordQuery.set_rowLimit(500); keywordQuery.set_trimDuplicates(false); var searchExecutor = new Microsoft.SharePoint.Client.Search.Query.SearchExecutor(ctx); results = searchExecutor.executeQuery(keywordQuery); ctx.executeQueryAsync(onQuerySuccess, onQueryError); } function onQuerySuccess() { var testing = results.m_value.ResultTables[0]; $.each(results.m_value.ResultTables[0].ResultRows, function () { users.push(this.AccountName); }); fetchProfilePropertiesForUsers(); } function onQueryError(sender, args) { alert(args.get_message()); } |