MS Flow and Azure: Creating Parent and Sub sites

The Assignment

Recently we were asked by a client to develop a MS Flow that creates a sub site when users enter a new item into a SharePoint list. What we found was there’s no simple, out of the box way to have the new sub site inherit the top navigation of the parent site. As a result, we needed to create an Azure Function to preform this function.

I was tasked with developing the Azure Function and calling it from the MS Flow. This assignment seemed fairly straightforward at the beginning – follow along with some pretty detailed tutorials and botta-boom, you are done. This couldn’t have been farther from the truth.

The tutorials I used are listed below, along with the specific code for inheriting a top navigation.

Tutorials

Creating an Azure Function

Registering the Azure Function with Azure Active Directory

Calling CSOM from the Azure Function

Call an Azure Function from Microsoft Flow

Code for Inheriting Top Navigation


dynamic data = await req.Content.ReadAsAsync();

string webUrl = data?.webUrl.ToString() ?? "";

using (var ctx = await csomHelper.GetClientContext(webUrl))

{

var web = ctx.Web;

ctx.Load(web, w => w.Navigation);

ctx.ExecuteQuery();

web.Navigation.UseShared = true;

ctx.ExecuteQuery();

}

Lessons Learned

Adding to my false sense of confidence, creating the Azure Function went off without a hitch. I was able to follow along with the tutorial without any issues, and before I knew it I had created an Azure Function. It is important to note that when you are creating your Function App, you will want to opt out of Application Insights. If you don’t, an Application Insight will automatically be built for your Function App. This is a billable service, so be prepared to pay if you forget this step!

After creating your Azure Function, you’ll need to register it with the Azure Active Directory. This is where the process got frustrating. The first thing to note is that the instructions are for users who operate Windows 10. If you are using an older version of Windows, you will not be able to use the PowerShell commands for creating the Certificate. Instead, you will have to revert to MakeCert commands.

The second, even more maddening issue is the quirkiness of the document editor that is used to edit the app registration manifest. The author of the tutorial goes so far as to calling the editor evil. I couldn’t agree with him more.

Not only does the editor throw out mysterious errors, but further research proves that their meanings don’t match their corresponding  titles. Don’t edit the manifest in the editor! Instead, download it, edit it in your text editor, and upload it back into the manifest editor. Then there’s the mysterious “keyValueMustBeNull” error. If you get this, simply create a new GUID and that should resolve the issue.

After navigating through all that madness, I was lured back into a feeling of confidence. Setting up the Azure Function to call CSOM went smoothly. There was one small step missing in the tutorial though: When creating the csomHelper.csx file, in addition to the changes noted by the tutorial author, make sure to plug in your Function Name in the certPath. I also recommend copying the code from the gist at the top of the blog, as it is slightly different from the code in the blog.

The roller coaster ride continued as I moved on to calling an Azure Function from MS Flow. I was not able to create a custom connector that worked successfully. During the “Prepare Security Configuration” step, my drop down did not show “API Key” as an option. I created the connector two different ways: Once by choosing “None” in the drop down, which did not give me a place to enter the API Key; And once by leaving the option blank, which did allow me to enter the API Key. Both resulted in the following error upon running the flow: “Unable to match incoming request to an operation.” I finally scrapped the idea of using a custom connector. Instead, I set up an HTTP call in the MS Flow using the API Key in the query parameters.

All in all, there were many great lessons learned. Hopefully, these observations help you to avoid all the headaches and frustration I had to endure.

 

SharePoint Conference 2018 Day 1 Recap

I was watching the SharePoint Conference North America 2018 Keynote (#SPC18 on Twitter) and I must admit, I “geeked out” a little bit about SharePoint Spaces and started to contemplate how I could convince the executive team to sign off on a Commercial Duane OdumHoloLens. If you are not familiar with SharePoint Spaces head over to the GeekWire article on SharePoint spaces by Nat Levy.  Essentially Microsoft is using Office 365/SharePoint Online to bring mixed reality creation to the masses.  The astute reader will notice that you don’t need the HoloLens but to you good reader, I say phooey…go big or go home.  If you or your organization want to get in on the private preview you can nominate your organization using the SharePoint Spaces Form (love that they are using MS Forms for this😊).  Continue reading “SharePoint Conference 2018 Day 1 Recap”

It’s a No Code/Low Code World in Office 365

Time to come clean…I have a love/hate relationship with Office 365. A majority of my work life for the past 3 years has been dedicated to Office 365 and while I see theDuane Odum excellent value it provides it’s taking away something I really enjoy, code.  While I was assisting a client with a OneDrive for Business rollout last week I had an epiphany. In the past 5 months I have probably written around 1,000 lines of code for work and it has mostly been JavaScript, TypeScript or PowerShell. I’ve not done a single line of C# code this year for work.  Some of the other folks in our group have so it has not been a total annihilation of managed code but it kind of has been for me and I do miss it.  Continue reading “It’s a No Code/Low Code World in Office 365”

What to do when an External User gets “Account not found in SharePoint Directory” Error

BScott Zischerky Rick Berryman

When a user attempts to log into their SharePoint site and gets a “Not found in SharePoint Directory” error, this usually means that the user received the External User invite at one email address, but used a different email address to accept the invite. When this occurs, the only fix is to remove all occurrences of both the user’s accounts (invite and acceptance) on the SharePoint site, explain the error to the user and how to properly accept the invite, then re-send the invite.

NOTE: In order to remove the email accounts of the external user, the person performing this task must have Site Collection Administration rights.

Continue reading “What to do when an External User gets “Account not found in SharePoint Directory” Error”

Microsoft Flow

What is Flow?

misc3_bg

Microsoft Flow is tool that allows one to create and automate workflows across multiple applications. To create a flow, the user specifies what action should take place when a specific event occurs. The most common use of flow is to trigger notifications. For example, flow can be used to send someone a notification when an item is added to a list.

Flows can also be used to collect data. For instance, if the user wants to see what people are saying about a particular brand, they can create a trigger that will capture new tweets that mention the brand and put a copy of each tweet into a database for further analysis. Once a flow is built, it can be managed on the desktop or through an app on a mobile device. Additionally, Flow can be integrated with other various Microsoft services. The Microsoft Flow Admin Center allows an administrator to manage users, permissions and roles and ensure that employee-created flows comply with data loss prevention policies. Continue reading “Microsoft Flow”

SharePoint Designer Workflow using Call http Commands

What’s this Blog about?

Karen Adkins

This blog lists some helpful tips and tricks about using the http GET and http POST. We’ll  walk through creating a SharePoint Designer Site Workflow that loops through an existing orders list to find pending orders which are added to a Historical Pending Orders List.

About Me

I know enough to be dangerous in the development world. However,  my current role does not allow for much development/power user type activities.  I know a little about json, xml, ajax calls, javascript.  To be effective, I need to search the internet for more answers!

 

Continue reading “SharePoint Designer Workflow using Call http Commands”

Connecting Existing Sites to Office 365 Groups…Kind of

One of the big announcements from the SharePoint conference in May was Microsoft planning to allow the connection of existing Team Sites to Office 365 Groups.  This was also championed at Ignite a few weeks ago and Microsoft even put out some more specific guidance on this in the Work better together with SharePoint Team Sites Office 365 App Integrations post by Mark Kashman. Roughly 1/3 of the way down the page there is a heading titled Connect an existing SharePoint team site to a new Office 365 group that details out exactly what we will need to do.  This is awesome, we can take advantage of all the benefits of Office 365 groups for our existing team sites…not so fast. Continue reading “Connecting Existing Sites to Office 365 Groups…Kind of”