Solved

Create SharePoint group in Nintex for O365


We have a requirement to create some SharePoint groups in sites immediately after site creation and apply those to lists and libraries within the new site with various permissions.

Is there a way in Nintex for Office 365 that we can create the groups and then apply those groups to lists and libraries with the appropriate permissions?

icon

Best answer by TomaszPoszytek 25 May 2017, 15:36

View original

3 replies

Userlevel 5
Badge +13

I don't know of a way in Nintex to create a group, however you are able to add users to a group and assign permissions to lists using that group using the "Update Item Permissions" and "Add User to Group" actions

Userlevel 7
Badge +17

To create a group you should use the Web Request action to call SharePoint REST API for "Users, Groups and Roles": Users, groups, and roles REST API reference  and make a POST request to the URL:

http://<server>/<site>/_api/Web/SiteGroups

Using the following headers:

content-type: application/json; odata=verbose
cookie: FedAuth={fedauth cookie};rtFa={rtFa cookie}

Optionally, you can use the "X-RequestDigest" token instead of the "cookie" header variable. To obtain FedAuth, rtFa or RequestDigest follow my post: Working with security credentials (RequestDigest, FedAuth, rtFa)

And the following body:

{ 
    '__metadata':{ 'type': 'SP.Group' },
    'Title':'Training',
    'Description':'Description of new group',
    'AllowMembersEditMembership':'false',
    'AllowRequestToJoinLeave':'false',
    'AutoAcceptRequestToJoinLeave':'false',
    'OnlyAllowMembersViewMembership':'true',
    'RequestToJoinLeaveEmailSetting':'true'
}

After you create your group you can then use the "Office 365 Set Permissions" action to grant the group specific permissions to your object and then using the approach Courtney described - add users to your group.

Just be aware, to put actions for a group creation and permissions granting inside an App Step action, so that thez will be executed with the elevated permissions thus won't face 401

Regards,

Tomasz

Badge +3

After a lot of trial and error, I just bumped into this Accelerator, which worked like a charm


https://gallery.nintex.com/5e30b379c1598d0045372b52/Create%20SharePoint%20Group

Reply