none
CSOM is not restricting user while updating people or group field RRS feed

  • Question

  • Hi,

    I have ppl or group column that is restricted to Test SP group. Through CSOM, I'm trying to add new user to this ppl column                 

    User superVisorUser = ctx.Web.EnsureUser(@"dev\pgalla");
     ctx.Load(superVisorUser);                    
     ctx.ExecuteQuery();
     supervisorUserFld.LookupId = superVisorUser.Id;                   
    oItem["SuperVisor"] = supervisorUserFld;
     oItem.Update();
    ctx.ExecuteQuery();


    I'ma ble to add user using above code, but it is allowing me to add user who is not present in Test SP group also. From List form UI, I can't do that

    Any idea why CSOM is not restricting non user of SP group

    Friday, February 10, 2017 6:49 AM

All replies

  • Hi,

    Set Person or Group field choose from one SharePoint group in List settings, it seems only restricted in UI.

    The Client Side Object Model and Server Side Object Model it not restricted.

    As a workaround, we can check whether the user in a group or not using code, if not in the group, don't allow update it.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, February 13, 2017 3:25 AM
    Moderator