Office 365 – Customizations too risky? Go for more development!

On the techcommunity site a question was asked about how to reduce the risk of updates breaking your Office 365 SharePoint solutions

In the past too many times SharePoint has been broken by updates deployed by Microsoft. In recent months the new interface broken the global navigation leaving users with unable SharePoint solutions.

So what should SharePoint developers do in Office 365 to avoid systems breaking?

Try to implement SharePoint without any branding. Just use the theme options available.


Then when you get to the point of developing the solutions within SharePoint develop apps/Add-in instead of pages with web parts.

Add-ins are separate from SharePoint and use CSOM to talk to SharePoint and therefore SharePoint upgrades will not cause any issues.

If you would like any help developing your apps/add-ins for SharePoint contact me at




Office 365 – PnP – SharePoint – Add-SPOFile – format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

Today I tried to upload a document to SharePoint Online using the Add-SPOFile command from the PnP PowerShell.

Add-SPOFile -Path $path/DocumentTemplates/MyTemplate.docx -Folder DocumentTemplates -Web $web -Values @{Title=”MyTemplate”;FileLeafRef=”MyTemplate.docx”}

This resulted into

format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

Then when I ran the script again with a breakpoint set on the Add-SPOFile. When my PowerShell ISE waited I ran the Add-SPOFile command manually. No errors would appear. OfficeDev/PnP

The above error means that some data can’t be displayed, but why not if it can display it when I run the command manually.

Then Erwin van Hunen gave me the answer.

$spfile = Add-SPOFile -Path $path/DocumentTemplates/MyTemplate.docx -Folder DocumentTemplates -Web $web -Values @{Title=”MyTemplate”;FileLeafRef=”MyTemplate.docx”}

Now the object is set in the variable $spfile and the error doesn’t appear anymore.


Office 365 – SharePoint – Are workflows important?

In SharePoint there are many different options for workflows. Microsoft and Microsoft partners have invested a lot of time creating different sorts of workflow solutions. For the more experienced user and developers there is a long list of options:

  • SharePoint Designer 2010 workflows
  • SharePoint Designer 2013 workflows
  • SharePoint out of the box workflows
  • Visual Studio workflows
  • Nintex
  • K2
  • and many more.


Recently Microsoft have launched Microsoft Flow as a new solution. but my experience with flow hasn’t been very good yet as the options available are quite limited (unless you use web services steps a lot) :

Office 365 – SharePoint Online – Creating list items using Microsoft Flow

Also Microsoft have announced that there will be no SharePoint Designer 2016.

So what does this mean to my workflow options?

Should I not use SharePoint Designer workflows anymore as they will be difficult to maintain in future? Or will SharePoint Designer 2013 simply work with the later versions of SharePoint?

Back to my initial question in this article. Are workflows important?

It looks like many solutions have been put in place in the past. With recent changes made in SharePoint Online/Office 365 the workflow solutions available seem to struggle to keep up with the pace.

So whenever possible the best platform to use will probably be Microsoft Flow, however with my recent experiences I found that if i want to stick to the free options that SharePoint Designer workflows still work better.




Office 365 – SharePoint – PnP – The object is used in the context different from the one associated with the object.

Today  one of my colleagues was trying to create a list item in SharePoint Online using the PnP PowerShell.

He was running the following command

Add-SPOListItem -List $dlist -Values @{“Title” = “$webTitle”}

and got the following error:

Add-SPOListItem : The object is used in the context different from the one associated with the object.
At line:4 char:5
+ Add-SPOListItem -List $dlist -Values @{“Title” = “$webTitle”}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Add-SPOListItem], InvalidOperationException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Lists.AddListItem


I noticed that the -web switch was missing

Add-SPOListItem -List $dlist -Values @{“Title” = “$webTitle”} -Web $web

So what happened?

When -Web is missing in PnP PowerShell Cmdlets the root site will be assumed as the site to be used.

therefore Add-SPOListitem will run on the rootsite while the list specified lives in a sub site.


Office 365 – SharePoint Online – Creating list items using Microsoft Flow

As SharePoint Designer 2016 isn’t going to exist I thought better look into the new Microsoft Flow.

I’ve got a list and every time a status field on a list item is updated I want to create an item in another list.

So i click on the create a flow in my list:


then I selected the When an existing list item is modified, complete a custom action template. Which is nicely located at the end of the list of available list templates:


Now I’m ready to add my steps. So first I need to check which field(s) were updated as I only want the Flow to run if a status field was updated to “Generate CVs”


So i add a condition:

Select my status field and type the value of the status:


Ok, this was the easy bit. No real need to add the detailed steps in this article.

HTTP step

Now, I added an HTTP step. When you add the first HTTP step you will not get the Orange outputs ( body, Headers, Status code).

the Http task lets call REST API calls to your flow.

As I want to add a list item, I decided to use REST (


Then I filled in the Method, Uri, Headers and Body and I got the following warnings:

So in the Uri section of the task I’m getting “Enter a valid uri”

In the Headers section I get: “Enter a valid json”

In the body I’m getting : “Enter a valid json”

So what is the format?

For the heading I needed to add ‘{‘ and ‘}’


“accept”: “application/json;odata=verbose”, “content-type”: “application/json;odata=verbose”



For Body I tried:

{ ‘__metadata’: { ‘type’: ‘SP.Data.TestListItem’ }, ‘Title’: ‘Test’}

This didn’t work. I replaced all the single quotes with double quotes and again my json is valid.

{ “__metadata”: { “type”: “SP.Data.TestListItem”}, “Title”: “Test”}

Ok, so just the Uri field left now. That can’t be difficult, can it?

After a couple of attempts I typed the following url:‘CVs’)/items

At first the quotes were invalid as I copied it form a website I got the wrong kind of  single quotes. I replaced these but still no luck.  Still the same “Enter a valid uri”.

Then I recreated my Http step in Flow reentered all the data and now it worked fine. It looks like the Uri is only validated once.

So now I can save my Flow. but when i run my flow I’m finding that i get an alert after a while:


Ok, this is good. At least by REST call was made. Now i just need to get my accesstoken issue fixed.

More to follow soon …