Skip to main content

SharePoint Online - Automate Site & Group Creation with Nintex Workflow O365

What
Nintex Workflow for O365 has an action to create a site automatically in SharePoint, but it's functionality is quite limited.  You can't create groups and you can't add staff to those groups.  This tutorial shows you how to create a Nintex workflow to automate the whole process using SharePoint Web Services.

Even better, we are going to create the ability to automate Site Creation across multiple Site Collections.

If you're looking for a tutorial on how to do this in Nintex Workflow 2010/2013, I've written an article here: SharePoint 2010 - Automate Site & Group Creation with Nintex Workflow 2010

Why
As most SharePoint administrators are aware, it's ALWAYS a bad idea to give staff the ability to create SharePoint sites.  They will end up creating them for the wrong purposes, will not maintain them, no retention policies will get assigned to them, etc.

However, you don't want to restrict your users creative freedom.  You want to govern it in a manageable way.

In order to keep track of all your SharePoint sites, we need to ensure that when we allow staff to create sites/content, it is being properly tagged with the right information.  As long as you are logging & tagging sites with extra data, you can easily govern and manage those sites far into the future.

This tutorial isn't simply how to automate a process that SharePoint already does.  It's automating that process while enforcing that users to tag their sites with data that will help you manage SharePoint easier.

We are going to use the example of Project Sites.  Project sites have a known lifespan, usually between 1 month & 2 years depending on size.  We want to capture that information so the sites don't hang around for too long.

How
There are 6 steps in my workflow, they are:
  • 1. Set Variables
  • 2. Create Site
  • 3. Create Group
  • 4. Add Group to Site
  • 5. Add Members to Group
  • 6. Send Emails

First:  Create a custom list with the following columns (depending on your needs):
  • Project Name
  • Site Description
  • Site URL
  • Site Owner
  • Site Type:  Project / Team
  • Department
  • Project Sponsor
  • Project Manager
  • Project #
  • Estimated Completion Date

1. Set Variables
I created & set the following variables so that the Web Services would run with the correct information:
Site Collection URL - used if you are planning to allow this workflow to create sites on multiple site collections
Site Template - If you want different site templates to be used on different types of sites
setting variables based on 'Site Type' (using Switch Action and Set Variable Actions)

2. Create Site
Use the following Nintex Action to create a site and add all the data you will collect from your list: Office 365 Create Site
Create Site Settings


3. Create Group
Use the following Action to query a Web Service:  Web Request

If you're wondering how I figured out what to input, this guide explains how to get SOAP Web Service Information perfectly: https://community.nintex.com/community/tech-blog/blog/2015/01/22/web-request-action-for-o365

Insert these values to create an 'Owners' Group on your Site Collection without access to anything:
  • URL: ‍{Variable:Site Collection URL}‍_vti_bin/UserGroup.asmx
  • Method: SOAP 1.1
  • Soap Action: http://schemas.microsoft.com/sharepoint/soap/directory/AddGroup
  • Body: Content
Body:

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">   
<soap:Body>     
<AddGroup xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">       <groupName>‍{Current Item:Site Name}‍ Owners</groupName>       
<ownerIdentifier>‍{Current Item:Site Owner}‍</ownerIdentifier>    
<ownerType>user</ownerType>       
<defaultUserLoginName>‍{Current Item:Site Owner}‍</defaultUserLoginName>       
<description>Used to manage permissions on this site: ‍{Variable:Site Collection URL}‍‍{Current Item:Site URL}‍</description>     
</AddGroup>  
</soap:Body> 
</soap:Envelope>


4. Add Group to Site
the hard part...

Now we need to give the group access to your newly created site.  Create another Web Request Action.

The picture will explain most things, however, to get the PermissionMask value (a value assigned to a permission level like Contribute,Read Only, etc), you need to run the following Powershell script on your server: SharePoint Online - Retrieve the Permission Mask Values for a Site using Powershell

FYI: For Owner access with Full Control, the permissionMask is always -1.

Once you have that, Insert these values
  • URL: ‍‍{Variable:Site Collection URL}‍‍{Current Item:Site URL}‍/_vti_bin/permissions.asmx
  • Method: SOAP 1.1
  • Soap Action: http://schemas.microsoft.com/sharepoint/soap/directory/AddPermission
  • Body: Content
Body: <?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">   
<soap:Body>     
<AddPermission xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">       
<objectName>‍{Current Item:Site Name}‍</objectName>       
<objectType>web</objectType>       
<permissionIdentifier>‍{Current Item:Site Name}‍ Owners</permissionIdentifier>       
<permissionType>group</permissionType>       
<permissionMask>-1</permissionMask>     
</AddPermission>   
</soap:Body> 
</soap:Envelope>

Running the AddPermission Web Method through the Permissions.asmx web service

5. Add Members to Group
You don't need to do this, but if you're feeling keen you can also run a web service to add a user to the newly created group.  Same setup as Step 4, just use the following settings:
  • URL: ‍‍{Variable:Site Collection URL}‍‍{Current Item:Site URL}‍/_vti_bin/UserGroup.asmx
  • Method: SOAP 1.1
  • Soap Action: http://schemas.microsoft.com/sharepoint/soap/directory/AddUserToGroup
  • Body: Content
Body:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">   
<soap:Body>     
<AddUserToGroup xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">       
<groupName>‍{Current Item:Site Name}‍ Owners</groupName>       
<userName></userName>       
<userLoginName>‍{Current Item:Project Manager}‍</userLoginName>       
<userEmail></userEmail>       
<userNotes></userNotes>     
</AddUserToGroup></soap:Body></soap:Envelope>

6. Send Emails
Of course now you want to send a nice customised email to your user with all the information they need!

Thoughts?
This saves our team so much time, while allowing us to govern site creation and ensure that all sites have metadata tagged against them !

Have you got any cool tricks to help automate governance that you'd like to share?

If you liked this post:
Credit where it's due
  • https://community.nintex.com/community/tech-blog/blog/2015/01/22/web-request-action-for-o365

Comments

Popular posts from this blog

Export Group Membership From Active Directory Using Power Query

If you need to export a list of staff from an Active Directory Group, follow these steps.  Allows you to gather all the names & usernames of staff in a particular group and save the information into Excel.

Step By Step How To:
Open up Excel > Power Query TabClick From Other Sources > From Active Directory:(In Excel 2016 this is found under: Data Tab > New Query > From Other Sources > From Active Directory) screenshots from Excel 2016 on left, Excel 2010 w/ Power Query Add-on right A popup will ask you to enter your domain name.  It should already be populated with the correct information but if not, input your companies domain name & Click OK:
In the Navigator that opens up, expand your domain tree and double click group:

You should now see a list of all groups in Active Directory in the Power Query Editor:
In order to find & filter for a specific Group, Click the Down-Arrow for the 'distinguishedName' column > Text Filters > Contains...
Type the name…

HP Laserjet 1022 Printer - Can't Print on Windows 10

If you are having trouble getting your laserjet working on Windows 10, here's how I resolved the problem:

Go to Devices & PrintersFind your printer & go to Printer Properties > Advanced TabSet Driver to: HP LaserJet 1022 Class Driver & ApplyIf HP LaserJet 1022 Class Driver is not available.  download from this site: http://support.hp.com/us-en/drivers/selfservice/HP-LaserJet-1000-Printer-series/439424/model/439431Print a test page.


SharePoint Online - Branding with CSS

-----------------------------------------------------------------------------------------
This post is related to a larger group of posts called Migrate SharePoint to Office 365 - Planning & Steps
-----------------------------------------------------------------------------------------

I've gone with a Publishing Site Collection so that I can use the 'Alternate CSS URL' in Site Settings > Master Page.

First off, thanks to the following websites which helped get me started:
http://blog.sharepointexperience.com/2015/02/sptechcon-austin-february-2015/#more-2766http://blog.sharepointexperience.com/2015/01/to-brand-or-not-to-brand/ Here's what the end result will look like (if you have the same fonts):


Now for the CSS...

/* Design By : Brett Randall*/
/*     Design Colours: Greens/Greys/Blues */
/*     Last Modified : 28/02/2017*/
/*     Description: CSS to rebrand SharePoint Online Publishing Site Collection that is using seattle.master */

/* TABLE OF CONTENTS
-- -…