SharePoint 2013 Client Side People Picker in Content Editor Web Part

Has anyone tried to use the client side people picker in a content editor web part? I have successfully got it to work in IE by adding all the script references and initialize function to the content editor web part. Now the strange part is, the people
picker doesn't render in other browsers, I tried in Chrome, Safari, and Firefox. Any ideas?

Below can be used to create people picker in CEWP
<asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js" type="text/javascript"></script> 
   <script type="text/javascript" src="../Apps/_layouts/15/clienttemplates.js"></script> 
   <script type="text/javascript" src="../Apps/_layouts/15/clientforms.js"></script> 
   <script type="text/javascript" src="../Apps/_layouts/15/clientpeoplepicker.js"></script> 
   <script type="text/javascript" src="../Apps/_layouts/15/autofill.js"></script> 
   <script type="text/javascript" src="../Apps/_layouts/15/sp.js"></script> 
   <script type="text/javascript" src="../Apps/_layouts/15/sp.runtime.js"></script> 
   <script type="text/javascript" src="../Apps/_layouts/15/sp.core.js"></script> 
   <script type="text/javascript">
<!-- Add your CSS styles to the following file -->
<link rel="Stylesheet" type="text/css" href="../SiteAssets/PeoplePicker/App.css"/>
<!-- Add your JavaScript to the following file -->
// Run your custom code when the DOM is ready.
$(document).ready(function () {
    // Specify the unique ID of the DOM element where the
    // picker will render.
    initializePeoplePicker('peoplePickerDiv');
// Render and initialize the client-side People Picker.
function initializePeoplePicker(peoplePickerElementId) {
    // Create a schema to store picker properties, and set the properties.
    var schema = {};
    schema['PrincipalAccountType'] = 'User,DL,SecGroup,SPGroup';
    schema['SearchPrincipalSource'] = 15;
    schema['ResolvePrincipalSource'] = 15;
    schema['AllowMultipleValues'] = true;
    schema['MaximumEntitySuggestions'] = 50;
    schema['Width'] = '280px';
    // Render and initialize the picker. 
    // Pass the ID of the DOM element that contains the picker, an array of initial
    // PickerEntity objects to set the picker value, and a schema that defines
    // picker properties.
    this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, null, schema);
// Query the picker for user information.
function getUserInfo() {
    // Get the people picker object from the page.
    var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerDiv_TopSpan;
    // Get information about all users.
    var users = peoplePicker.GetAllUserInfo();
    var userInfo = '';
    for (var i = 0; i < users.length; i++) {
        var user = users[i];
        for (var userProperty in user) { 
            userInfo += userProperty + ':  ' + user[userProperty] + '<br>';
    $('#resolvedUsers').html(userInfo);
    // Get user keys.
    var keys = peoplePicker.GetAllUserKeys();
    $('#userKeys').html(keys);
</script>
</asp:content> 
<asp:content contentplaceholderid="PlaceHolderMain" runat="server">
<div id="peoplePickerDiv"></div>
    <div>
        <br/>
        <input type="button" value="Get User Info" onclick="getUserInfo()"></input>
        <br/>
        <h1>User info:</h1>
        <p id="resolvedUsers"></p>
        <h1>User keys:</h1>
        <p id="userKeys"></p>
    </div>
</asp:content>​​​​​​​​​
Vishnu

Similar Messages

  • SharePoint 2003 : Cannot open the Rich Text Editor in Content Editor Web Part

    Error message when you use the Rich Text Editor in a SharePoint Portal Server 2003 Service Pack 3 Content Editor Web Part: "Cannot open the Rich Text Editor"
    Mohamed Gamal Orief Senior Software Engineer ITWORX EGYPT Phone: +202.2673.6377 Mobile:+2010.0552.7971 www.itworx.com

    Hi Mohamed,
    Please check if your issue is the same as the following article cannot use Rich Text Editor in a CEWP on a Vista client, if yes, you can install the kb 941204 hotfix for your SharePoint 2003, then check result again.
    http://support.microsoft.com/kb/949604
    http://support.microsoft.com/kb/941204 (Description of the SharePoint Portal
    Server 2003 post-Service Pack 3 hotfix package: February 26, 2008)
    Thanks,
    Daniel Yang
    Forum Support
    If you have feedback for TechNet Subscriber Support, contact [email protected] 
    Daniel Yang
    TechNet Community Support

  • Uploading multiple documents into sharepoint list item with REST in sharepoint 2013 using content editor web part :

    hi ,
    i am trying to upload multiple document files into sharepoint list item. I followed below link for implementaion.
    http://techfindings-prem.blogspot.in/search/label/jquery.multifilejs
    It was working for sharepoint hosted app.
     This complete code is written within content edito web part.
    It was working when i was in root site collection with below change (hard coded the root level url) in code in "UploadFile" function.
    var scriptbase = "http://servername" + "/_layouts/15/";
                console.log(' File size:' + bytes.length);
                $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    But the issue came in picture when i was working with the other site collection instead of root one. The url was like below.
    "http://servername/sites/cpg/". This time i need to be there within "cpg" site collection. 
    Now if i hard code the url as i did above my code gets break here while come to below line
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
    I am getting error when i used below code:
    var scriptbase = "http://servername" + "/_layouts/15/";
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    Please hekp in this case. This complete code is written within content edito web part. 
    Regards:
    Sanjay Joshi

    Hi,
    According to your post, my understanding is that you have an issue about upload multiple documents files into library vai REST API.
    As you have said, you have used the hard code url in your code.
    How about use the _spPageContextInfo.webAbsoluteUrl method to get the url?
    I have used this method to get the url, then use the code in the article you have pasted within a content editor web part to upload the files.
    You can replace the hard code url with the _spPageContextInfo.webAbsoluteUrl method, then check whether it works.
    Thanks,
    Jason
    Jason Guo
    TechNet Community Support

  • Add a content editor web part to right side of to default searchresults layout in search center

    i need to display a content editor webpart in right side of search results page
    Is it possible to do it without making changes to the layout.In page i dont have a webapart zone
    on right side to add content editor to right.Is it possible to add it to right side without making changes to default searchresults layout

    Hi,
    Based on your description, my understanding is that in your production environment, it doesn't search the contents of Content Editor webparts.
    It is by default in SharePoint that Contents in a content editor web part aren't searchable .
    You can create a content source that crawls web pages it will pick up the contents of a content editor web part.
    Here are some similar post, you can use as a reference:
    https://social.technet.microsoft.com/Forums/en-US/148464b3-6229-4e33-b5cd-826119c9adf1/can-you-search-a-content-editor-web-part?forum=sharepointsearchlegacy
    https://social.technet.microsoft.com/Forums/en-US/d50273ee-8eec-4291-bee5-1817182026d9/wss-30-content-editor-web-part-not-searched?forum=sharepointsearchlegacy
    Best Regards,
    Lisa Chen

  • Custom SharePoint Master Page with Content Editor Web Part.

    Hi All,
    I have created a custom SharePoint Master Page to apply within my SharePoint Site and it was a success.
    When I want to add the content I have to use the script editor web part and add HTML snippets. Then the styles will reflect correctly. But when I use content editor web part some of the styles do not reflect. Lets assume that if I want to add a H2 with the
    custom color, the color do not show in the ribbon. And how SharePoint know that this is an <h2> and reflect the other styles like padding, margin and so on.
    Please can someone help me to solve this.
    Thanks and regards,
    Chiranthaka

    Hi,
    From your description, my understanding is that you want to add CSS code in your customized Master Page with content editor web part.
    I tested your issue in SharePoint Designer, and I added CSS code successfully.
    I accomplish your requirement with steps below:
    Add a content editor web part in a list and add some CSS code in the web part.
    Open SharePoint Designer, enter the master page.
    Insert a content editor web part under INSERT tab in the Ribbon.
    Open the list that have edited in step1 in the SharePoint Designer.
    Copy code from the list to the Master Page as the screenshot below.
    The screenshot below is my result:
    In addition, why do not you add CSS code just with <style> tag in your page? Just add CSS code as below(in this method, you do not need any web part.):
    <style>
    h2{
    background-color:green;
    </style>
    Best Regards,
    Vincent Han
    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]

  • Relative Path for Jquery into Content Editor Web Part

    Hi;
    I'd add a Content Editor Web Part (CEWP) to a web part zone. I'd edit that CEWP in HTML view and add my script which load Jquery and my question :  how to use a relative
    path for Jquery :
    <SharePoint:ScriptLink Name="SP.js" runat="server" OnDemand="true"
      Localizable="false" />
    <script src="/sites/XXX/Style%20Library/Scripts/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    My code
    </script>
    Regards

    Hi;
    Firstly, I have used : 
    <script src="/Style%20Library/Scripts/jquery.min.js" type="text/javascript"></script>
    But any result and any change and If I add /Sites/XXX/ : it works correctly ?
    My code is :
    <SharePoint:ScriptLink Name="SP.js" runat="server" OnDemand="true"
        Localizable="false" />
    <script src="/sites/XXX/Style Library/Scripts/jquery.min.js" type="text/javascript"></script>    
    <script type="text/javascript">
    ExecuteOrDelayUntilScriptLoaded(displayTitle, "SP.js");
    var site;
      var context;
      function displayTitle() {
        //Get the current client context
        context = SP.ClientContext.get_current();
        //Add the site to query queue
        site = context.get_web();
        context.load(site);
        //Run the query on the server
        context.executeQueryAsync(onQuerySucceeded, onQueryFailed);
    function onQueryFailed(sender, args) {
      alert('request failed ' + args.get_message() +
        '\n' + args.get_stackTrace());
    function onQuerySucceeded(sender, args) {
        $("#layoutsTable table th span").html("Bienvenue sur le site " + site.get_title() + " - Direction Technique");
        $("#zz17_V4QuickLaunchMenu ul.root li span:contains('Biblioth')").parent().parent().hide();
        $("#zz17_V4QuickLaunchMenu ul.root li span:contains('Listes')").parent().parent().hide();
    </script>

  • How to modify title and tooltip text in Content Editor web part

    I have inherited a site with a page that includes two Content Editor web parts. The web parts have been left with the default titles (Content Editor [1] and [2]) and mouse-over text.
    I want to set these to something more appropriate so I choose the option Edit Page (to edit the web parts on this page). I can move the web parts around (so definitely in Edit mode) but if I click the Edit Web Part Properties the page refreshes but no properties
    or options (or errors) appear.
    How do I modify these web parts?

    When you select the edit web part options, the page should reload with the configuration options on the right hand side. This will include several collapsed sections, namely: -
    Appearance
    Layout
    Advanced
    If you maximise the appearance one, you'll see a text field for "Title."  Edit this to what you want and you'll be able to rename these.
    If you can't see the options, make sure to scroll to the far right hand side of the screen.  Sometimes on larger resolution monitors, they can appear hidden.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Target Audiences in Content editor web part created from Snippet Gallery

    Hi,
    I have created a Content editor web part from the Snippet Gallery in SP 2013 Office 365 and placed it in my master page.  It works, but not the Target Audiences.  It's linking to a text file which displays, but I only want certain AD groups
    to be able to view. Everyone can see the web part. 
    Any help would be appreciated.
    Thank you!

    I am having the same issue.  Did you ever resolve it?

  • Content Editor Web Part Blocked Me Out

    I was working on updating my department's Sharepoint site. While in Edit mode, I clicked
    on a link titled "Add a Web Part" and began looking at the different Web Parts to add. When I clicked on a blank one, I was unsure of what it would do, so I did not click add, I closed the screen with the "x" button thinking it would not
    save. I was wrong. After closing the screen and opening back up the page, all I see is is a bar saying "Content Editor Web Part" and I cannot access any of the links above to edit the page. Please help!!!

    Hello,
    It seems you have added the CEWP on page. To delete thsi webpart just open the page once again and add "?contents=1" at the end of URL. Now it will show all added webpart on page, you can delete unwanted webpart from page.
    Refer this link for shortcut links:
    http://artykul8.com/2011/03/useful-sharepoint-shortcuts/
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Add Tab ability to Content Editor Web Part

    Just wondering if there is an easy way to add a content editor Webpart to a SharePoint Online (office 365) SharePoint site where the code in the CEWP would created 2 tabs and the user could then put different content to display on each tab.  When a
    user clicks the other tab, the CEWP switches to that content.
    Thanks!

    Hi,
    According to your description, my understanding is that you want to create a tab and when switch the tab to display different content in SharePoint Online site.
    I suggest you can use Jquery API tabs plugin to achieve it. You can add a content editor web part and then add Jquery code in it.
    Here is a code snippert for your reference:
    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery UI Tabs - Default functionality</title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script>
    $(function() {
    $( "#tabs" ).tabs();
    </script>
    </head>
    <body>
    <div id="tabs">
    <ul>
    <li><a href="#tabs-1">Nunc tincidunt</a></li>
    <li><a href="#tabs-2">Proin dolor</a></li>
    <li><a href="#tabs-3">Aenean lacinia</a></li>
    </ul>
    <div id="tabs-1">
    <p>Test1</p>
    </div>
    <div id="tabs-2">
    <p>Test2</p>
    </div>
    <div id="tabs-3">
    <p>Test3</p>
    </div>
    </div>
    </body>
    </html>
    More information for your reference:
    Jquery Tabs
    Thanks
    Best Regards
    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]
    Jerry Guo
    TechNet Community Support

  • Disable link for a Image in Content editor web part

    Hi
    i want to disable hyperlink for a banner added using content editor web part. Instead of hiding using Target Audience, i want to disable the link.
    Please help me how can i achieve this?
    regards,
    Vinay
    Thanks and Regards, vinnu

    Hi Vinay,
    I recommend to disable the link for an image using Jquery in Content Editor web part.
    First, you need to use F12 tool in Internet Explorer(IE) to get the html tag for the image, and you’d better find the class or id value for the tag of the image.
    For example, if the class for the image is test, then the code should be:
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript">
    $('.test').click(function(e) {
    e.preventDefault();
    </script>
    You can also paste the code of the image here for further research.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Resize Content Editor Web Part to Page Width

    I have a content editor web part in page.   The CEWP contains a javascript based menu and an Iframe.
    The problem is that when I resize the page, the width of the CEWP does not size to the width of the browser.
    How can I get the CEWP to resize to the browser?John Bailo

    John, can you provide insight on the script you used for this? I'm trying to accomplish the same thing.

  • Creating a persistent check box in a Content Editor Web Part

    I'm using the following HTML in a Content Editor Web Part to display a check box.  It works great, but how can I make the checkbox state persistent? (i.e, it remembers whether it is checked or not between sessions).
    HTML: <input name="Completed" type="checkbox" value="Completed"  />

    Hi
    Adoukusa ,
    For creating a persistent check box in a Content Editor Web Part, you need to use cookie to store the state of the checkbox and maintain the state by reading / writing cookies.
    Here is JavaScript cookie sample code:
    function createCookie(name,value,days) {
    if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
    function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    return null;
    function eraseCookie(name) {
    createCookie(name,"",-1);
    Reference:
    http://stackoverflow.com/questions/1154258/persistence-of-checkbox-values
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • SharePoint 2013 Client Side Object Model Javascript

    Hi,
    I am using Javascript Client Object Model in SharePoint 2013. What i am trying to do is:
    retrieve items from a particular list which exist on an another site collection. However, the Items that I want to retrieve will be based on particular value in the current site's list where I am writing the script.
    So for eg: I have a sharePoint list called "project status" in site A with project name (hyperlink URL field)  and project status as Managed metadata fields as two fields.
    I have site B where I have  "projects" list with Project name as the URL field. what I want to do is compare the project URL name in Projects list in site B to the Project name  URL in Project status list in Site A and retrieve the status
    so I can do a dashboard in site B using the same status in Site A

    Hi Cooltechie1234,
    You can filter the list item using CAML Query firstly and then set the managed metadata field label using JavaScript Client Object Model.
    If you have trouble in CAML Query, I suggest you can use CAML Designer to figure it out.
    More reference:
    http://cann0nf0dder.wordpress.com/2013/04/10/search-caml-query-with-managed-metadata/
    http://sharepoint.stackexchange.com/questions/113146/how-do-you-properly-write-to-a-managed-metadata-column-from-jsom-sharepoint-20
    http://www.vrdmn.com/2012/12/working-with-taxonomy-and-javascript-in.html
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • SharePoint 2013 RSS Viewer not loading when other Custom web part using Update Panel or Ajax Timer control

    Hi,
    SharePoint 2013 RSS
    Viewer web part failing to complete loading when the page loads.
    This happens when having RSS Viewer and then adding a Custom webpart with an updatepanel and timer control.
    I  had used Ajax update panel and timer control to load the web part asynchronously after the main page is fully loaded.
    The RSS-Viewer web part hangs in loading state while the custom webpart loads just fine.
    The issue occurs when an like button click or Timer Tick event fires after the page
    is loaded.
    Haven't been able to track the issue.
    Couple of workaround I tried to call a server side button click event from the custom web part after the page gets fully loaded using JQuery shown below did not work out either.
     $(document).ready(function () {
                $('#<%= netButton2.ClientID %>').click();
    And 
    document.onreadystatechange = function () {
                if (document.readyState == "complete") {
                    $('#<%= netButton2.ClientID %>').click();
    Please let me know how to resolve this issue.
    Thanks,
    Franklin

    Hi Johan,
    The assignment of this user on the given task might be corrupted. Try to remove the resource from the task, publish the project, assign the resource again and publish again the project. If it is not working, try to unpublish the task (column "publish")
    and publih it again.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

Maybe you are looking for

  • K9A2 Platinum v2

    This K9A2 Platinum v2 of mine has a lot of wierd issues. -The board never been 100% stable during a week under XP SP2 or under SP 3 (like my KT3Ultra2).I always had to try different drivers for the video,mobo,sound and different timings for my ram mo

  • Is it possible to change the location of the user component directory in TS4.0

    I would like to override the default location of the user component directory to a network drive / source control file system, in order to execute my own loginlogout sequence without having to deploy any files locally. is this doable in TS 4.0? If so

  • Skins dissappear when Flash movie placed

    I am using the example procedures as shown in the Adobe Book, Flash CS3 Professional Video Studio Techniques. (Chap 5 specifically). I want to place a Flash movie inside of an HTML page. I created my Flash Video (Action Script 2.0) both ways (FLV Pla

  • White Color are grey after rendering !

    Hello ! first post on this forum ! I'm working on a composition whith white background ... but after rendering in format such as WMV, and playing this video on different players, the white background look soft grey ! any idea about this problem ?

  • Uninstall FCS3 & Adobe cs3?

    I'm ready to do a clean reinstall of snow leopard as suggested by an Apple store genius. Should I uninstall both FInal Cut Studio 3 and Adobe Design premium CS3 prior to the clean install or just let the formatting process wipe it out & then reload t