1

How to set "Only Group" picker in sharepoint 2013 list, instead of "People and Group"

  • I think SharePoint is not providing this in OOTB. Workaround of this is, create one dropdown and fill it with all the groups from the site. – Dikesh Gandhi Sep 8 '16 at 8:52
2

SharePoint is not providing this in OOTB. But you can do the workaround for this.

You can create one dropdown control for that and fill it with SharePoint group names. Fetching group names from the site using below code.

C# code:

using (SPSite topLevelSite = new SPSite(ConfigurationManager.AppSettings["ForumSharepointInstanceUrl"]))
{
using (SPWeb rootWeb = topLevelSite.OpenWeb())
{
foreach (SPGroup group in rootWeb.Groups)
{
//go do something clever...
}
}
}

Reference: this link

JavaScript code:

var siteUrl = '/sites/MySiteCollection ';

function retrieveAllUsersAllGroups() {

    var clientContext = new SP.ClientContext(siteUrl);
    this.collGroup = clientContext.get_web().get_siteGroups();
    clientContext.load(collGroup);
    clientContext.load(collGroup, 'Include(Users)');

    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}

function onQuerySucceeded() {

    var userInfo = '';

    var groupEnumerator = collGroup.getEnumerator();
    while (groupEnumerator.moveNext()) {
        var oGroup = groupEnumerator.get_current();
        alert(oGroup.get_title());

    }
}

function onQueryFailed(sender, args) {

    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
0

It is not possible to do this with the out of the box columns provided by SharePoint 2013. One idea is that you can create a list an maintain the names of the groups there and have a lookup column created to that list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.