[Nintex Workflow] Add user to Site Collection Administrator group with REST API

Standard

Helping people to automate their workplace is my passion and lucky for me I also get paid to do so !

This week I was finishing working with a partner to improve the (poor) automation steps required by Matter Center, which no-one can really complain because Microsoft made it open-source.
Matter Center documentation requires to create each client as a new site collection in PowerShell, but this is not quite possible if the users registering these new clients on a daily basis are regular Office 365 users and not SharePoint Administrators.Thanks to a few Nintex Workflows we managed to do all the configuration in the background.

Thanks to a few Nintex Workflows we managed to do all the configuration in the background.
Today’s post is not about the site collection creation so I will spare the details, but in summary and very high level, I developed 4 workflows, 1 CSOM Javascript to be executed on the browser, and 1 Nintex Form of course for submitting the new client on desktop or mobile.

Now this quick blog post is regarding the challenge that we had to add the user as a Site Collection Administrator of that newly created site collection.

Since there is no mention of the sort in https://community.nintex.com it may useful for someone, so here it is:

  1. Create a new Nintex workflow in an Office 365 site list.
  2. Download and Import the .NWP workflow file available here to replace the blank workflow
  3. Edit a few of the actions at the beginning of the workflow to set the variables (I never hard-code UserName and Password for instance, so you will see a few Lookup to a different list to get the value, which you can replace since they will be showing an error once imported into your list)

Note: In this workflow, the “user” I am adding to the Site Collection Administrators group is actually the “CreatedBy” of the list item, which may sound strange since the user running that workflow may be the CreatedBy. However this is NOT the case (refer to above point: we do not want all users to be SharePoint admins!), here is how you should sequence the workflow to start:
1) After the List Item is created, a first workflow (run by CreatedBy) i.e. called “Start and Call workflow 2” and in the workflow we just add a “Start Workflow”

2) then within that first workflow we just add a “Start Workflow” making sure that this action is bein executed in an “App Step” in order to use “elevated privilege”.

Nintex_Workflow_for_Office_365

3) finally all the actions are happening in Workflow2 (which you imported in step 2)

 

Hope this helps someone.

François.

Advertisements

Back to SharePoint basics: create a list for leavers

Standard

I receive too often this request (from my sister this week;-):

Can I create something in SharePoint to let my colleagues log their own holiday so that I can later export that list to Excel ?

So here is a quick video with step I made, following this should give you just that.

Add to this the out-of-the-box SharePoint Alerts and you will receive a notification each time a new leave is registered.

Nothing much to it, no workflow approval plugged-in, but nice and simple SharePoint OOB No-Code solution that is quite often overlooked.

(sorry for the Audio which is not great, as I said, it’s a quick and dirty tip)

Sharepoint 2013 “mark task complete”

Standard

A great new feature in 2013 is the ability for a user to “mark task complete” straight from the task list without having to edit the item and click.

Screenshot below illustrates what this is

task

The issue I had today is that -somehow- the column to tick that task was actually not showing anymore from the task views. The list is definitely a Tasks list but the content type although originally inheriting from the out-of-the-box Task parent Site Collection CT has some custom columns in the site Content Type level.

Cause of issue (why the column was gone): not found yet, may be the “completed” column was edited by a user with design rights, but the formula inside was correct.

Solution: that’s the bad news.

  • Re-adding the column again didn’t work as it would not show the column as a Check Box magically but as a value “Yes/No” .. not useful.
  • Recreating the view and making it exactly like an out-of-the-box task view did not work, same as above.
  • Only solution was to re-create the list fully, and re-add the Custom Task Content Type, then remove the default “Task” Content Type. Once done task can be copy across if needed, as long as there no workflow in progress users will not be disturb as you may even change the URL to the original list later on.

Not a great finding on this feature I am afraid, but since nothing came up on a quick internet search I thought I would share it.

Have you ever wondered how to re-use this “mark as complete” in a fully customised list (not tasks App originally) ? One would think it’s the whole point of having such column, to be able to re-use it somewhere else, right. I could not.

Anyone  ?

 

Am speaking at #SPSUK next week

Standard

Just a quick post since I forgot to mention that I will be speaking at SharePoint Saturday UK next week, this is the 9th November and in the middle of Leicestershire (I had to check on Google Maps myself again).

To make the session a bit more lively I will be presenting with my friend and Sharepoint Architect Ben Ahmed the latest in Business Intelligence and open data stream from Enterprise Systems such as CRM.
Anything that has “power” prefixed is on the menu: PowerQuery, PowerPivot, PowerView and even PowerMaps 3D). A very exciting subject to make boring data actually beautiful and interesting in just a few clicks !

SharePoint Saturday is usually a great day where subject-matters people sacrifice one family day to learn and socialise with others, this one is going to be really cool as we are now getting the benefits of months of real business stories of SharePoint 2013 and Office 365.

More info about the event here http://lanyrd.com/2013/spsuk.

Don’t be fooled by InfoPath login prompt

Standard

A short sharing since I was amazed of the quality of feedback I received today from InfoPath and could have spent hours on this.

Steps:

  1. Create an infopath form (here 2013, but may be the same in previous versions as it hasn’t moved that much at all since 2007)
  2. Publish it to Sharepoint (2013) as a Content Type
  3. Bang ! Infopath prompts for a login/password for the Webs.asmx web service
  4. Infopath publish error
  5. Entering any login still fails.

After a bit of thinking I went back a few step on that Publishing dialog box and noticed that I pasted some text that my client wanted to see displayed and it was just that: InfoPath didn’t like to transform the Description of the form or Sharepoint refused it because some characters were incorrectly formatted.

Avoid characters

So don’t be fooled by InfoPath / Sharepoint, the error doesn’t always lays where you think it is.

Steps to format a SP2013 site differently depending on the device

Standard

 

This week I was doing some research on how to design to use the new Sharepoint 2013 “device channels” feature which allows designers to show a different MasterPage per device (link), as opposed to just enabling a unique mobile format for all devices.

How to make this

imagelooks like that image took me a good part of the day !

I found a bit of help in various places and will say that JussionSharepoint probably has the most comprehensive steps however he doesn’t discuss designing the Master Page and Layout Page in HTML which is now the recommended way in SP2013, Sonja’s Sharepoint2013 blog also has some valuable reading, but because my brain tends to think in a bullet list kind-of-way so here are my quisksteps on the subject.

[warning] I was going to describe all the steps to configure so that you can navigate your site with a mobile device. However while I was doing so I couldn’t figure out why it still didn’t work on the homepage of my 2013 environment. So here are the pre-requisite before attempting any design. [/warning]

Pre-requisites

1- only works with Publishing Feature enabled

image

2- only works with Mobile Brower View Feature disabled (otherwise it takes over)

image

3- finally (this one too me even longer to figure out!) only works if Wiki Page Home Page feature is disabled.

image

So now that we got that figured out, we can proceed to the customisations.

My 5 or 6 Steps

1) First of all you need to be able to access your Sharepoint site from an HTML editor (I used Notepad++) , so you need to map your computer to the Sharepoint site as a network drive.
2)

Open Site Designer

image

3)

Create mobile master page

imageimage
(use Design Manager to add snippets of code to your HTML file that you will open from your client HTML editor and save again)

4)

Create a new Channel for the mobile device (here you can see iPhone)

image image

5) Edit Site Master page settings
image
to assign the Channel to the mobile Master page
image
6)

Optionally …. Create new Layout page, however in my case it showed an error in Design Manager:

image

To fix:

  • click on the link shows you the error, it seems that Sharepoint is creating a blank Layout page with a few errors as a duplicate <head/>
  • Edit the HTML and correct it by deleting <head /> on Line 10
    image
  • and <title> to </head> on Line 26.
    image
  • Save the HTML and go back to Sharepoint, within a few second it would have converted succesfully
    image

(same as for Master Page use Design Manager to add snippets of code to your HTML file that you will open from your client HTML editor and save again)

I said Optionally for step 6, because there is not point creating a LayoutPage just for a certain device unless you are designing a site specific for a device OR you are going to create a page for each device.

Now open the site in Chrome or IE9 and you can change the user-agent so that it simulates you browsing from a mobile device. My preference at the moment is “User-agent Switcher for Chrome”.

Other tips to share

A few things I experienced that I would place in the “good to know” :

– rename the alternative MasterPage for a channel and it will break all channel (ie I renamed the masterpage for iPhone only, the home page errored when opening it using the defaut channel (IE or Chrome), until you edit the MasterPage settings and fix the missing MasterPage for that channel you renamed.

– after I edited the HTML of the Master page a few times, for no reason there was a large blank space that would be added between some DIV elements, even though they were not showing in the code. I had to remove the .master, it will get re-created form the .html within the same second but fixing the blank lines.

Conclusion

Now I have to say I am not impressed… Basically it would be great to build a LayoutPage for each device so that when you load the page one device A it will be LayoutPage A that opens. This way the webpart zone that have been defined horizontally for computer devices could be changed vertically for phone devices.

But that’s not the way it works, because each webpage uses a LayoutPage and that one is not dependant on the channel. The Master Page is the one that depends on the channel however MasterPage do not hold Webpart Zones but the Content Place Holder for the Layout Page.

Therefore there is still some good design work to do if you want to have a full any-devices-friendly sharepoint site.

In the meantime I will play more with the Mobile Browser View features that turns a site into mobile as it may just be the answer.

Of course it will not be adapted to all devices, and what would be nice is to use this feature “most of the time” and for a couple of page to create a layout that uses our special channel Master Page, but since both cannot co-exist it’s a no go for now.