Redirecting SharePoint list's NewFormUrl and EditFormUrl to Power Apps

In this scenario, we have a Power Apps app that takes a query param() “AssetID” and determines whether the app should create a new item or update an existing item.

We want to change the SharePoint default New or Edit items on a modern SharePoint list to go to our App. The app is a landscape canvas application and not an integrated portrait application (so we can’t use SharePoint form setting to switch this).

Because SharePoint’s New and Edit forms must be server relative pages, we can create a redirect page.

Steps

  1. Use Param in Power Apps

  2. Create a simple redirect page

  3. Change SharePoint’s NewFormUrl and EditFormUrl to this redirect page

  4. Test: Redirect to PowerApps

  5. References

Use Param in Power Apps

https://powerapps.microsoft.com/en-us/blog/powerapps-deep-linking/

Create a simple redirect page

Create a redirect ASPX (HTML) page and upload it into the SitePage library. I saved this as "AssetEditForm.aspx"

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Page Language="C#" %>
<%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Asset Form</title>
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<SharePoint:CssRegistration Name="default" runat="server"/>
<script type="text/javascript">

function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split('&');
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split('=');
        if (decodeURIComponent(pair[0]) == variable) {
            return decodeURIComponent(pair[1]);
        }
    }
//    console.log('Query variable %s not found', variable);
}
var play = "https://apps.powerapps.com/play/e3fdef18-2be5-4d25-ba04-3edf6411c0aa?tenantId=afa78dff-85bb-46f3-b036-b43bcf79c497";
var id = getQueryVariable("ID");
if (id) {
    window.location.replace(play+"&AssetID="+id);
}
else {
    window.location.replace(play);
}
</script>
</head>
<body>
<form id="form1" runat="server">
</form>
</body>
</html>


Change SharePoint’s NewFormUrl and EditFormUrl with PnP-PowerShell

Connect-PnPOnline -url https://johnliu365.sharepoint.com/
$list = Get-PnPList "Asset"
$list.ContentTypes[0]

# assuming list content type 0 == Item
# otherwise, you need to set this on the correct list content type

$list.ContentTypes[0].EditFormUrl = "SitePages/AssetEditForm.aspx"
$list.ContentTypes[0].NewFormUrl = "SitePages/AssetEditForm.aspx"
$list.ContentTypes[0].Update($false)

# no update child content types
# you may have to set $true if you have content types in your list

$context = Get-PnPContext
$context.ExecuteQuery()


Redirecting Magic

This will change the “New”, “Edit” behaviour on the SharePoint modern or classic list. Also, this will work in the edit menu. So if you want to redirect your users to the new Power Apps experience, this is one way to change the link everywhere.

Reference Reading

Please also read April Dunnam’s two part series on how to customize SharePoint via modern ListView JSON

True Governance of the Power Platform

track-2.jpg

It’s very early Sunday morning and I’ve just returned from an red-eye flight home from a week spent in Perth with Paul, Ashlee and Terrie Culmsee, meeting their many clients, participating in Perth App in a Day, and talking about PowerApps, Flow and Power Platform Governance.

It is testament to Paul’s nurturing of his clients that every company that I talk to on this trip have the same forward thinking mentality.

Many of the companies I had talked to online, or here in Sydney also shares these same traits. They want to implement proper governance of the power platform.

You might be on the same journey - I wish you the best, and I want to support you in this quest.

True Governance is about creating a partnership

The scenario is the same, over and over and over. Business wants agility, they want applications that traditional IT struggles to deliver.

IT already struggle with supporting existing applications created by Business - they worry this is yet another thing they need to support - these “citizen developed apps” will fall into their laps, not following best practices, not documented, and yet highly business critical.

Power Platform is an opportunity, to ride this wave and fix the partnership problem in your business.

True leadership, are the managers seizing this unique opportunity to (re)engage Business and IT

Because traditional IT has become the department of “No” - modern business units and IT doesn’t really want to talk. And in the last few years, many businesses rode the Microsoft Power Platform submarine to get applications developed under the radar to reach critical mass first. Always easier to ask for forgiveness than blessing.

In this paragraph, I want to speak to you - the business. You must understand, there is an virtual ceiling you are about to hit. Let me explain.

See - your empowered citizen developers are learning as they go, their first apps may not be that fantastic, while they solve critical business problems - there may be bugs and we see there will always be more incremental improvements needed.

As the number of Power applications you create increases, your limited number of citizen developer will reach capacity. Without being able to properly support these apps, they can’t make more apps.

You still need more apps. But your citizen devs’ hands are now full. Worse, what happens if they take a role elsewhere? Who can support these apps?

The correct answer is, business should take a cost code to IT and ask IT to support these apps. IT should be paid to build internal capacity to understand, administer, and govern the Power Platform.

Ideally, someone that understands the Power Platform should lead this team and effort. They are the bridge that talks to Business and IT. The ultimate navigator that will unite the business and IT.

Look across to any successful enterprises now scaling to hundreds and thousands of Power Apps and Flows. This pattern is the same. Over and over.

IT must realize that part of governance is this great opportunity - go talk to your business. Find the super maker that is helping with adoption, and able to put together business plans that will include a maintenance support fee to IT. Stop being “free support” (see my previous blog post) and start being part of value generation in your business.

An emerging trend is that the internal super Power Platform maker joins the IT side of the business to be that navigator. Governance and adoption tools (I have a list near the end) support the quest of this navigator. Business pays IT to support and maintain more Power Apps and Flows.

Do you think this is not possible? This is a fairy tale? I saw these relationships, these bridges forming everywhere. Is this not your experience? Have a look around.

If you are an IT manager, rather than look at the Power Platform with fear, close your eyes, and reopen them and see it as the biggest opportunity you have ever had in the last decade.

A low code platform the Business wants, with tools and reports for IT to properly function and support this platform. Don’t squander this and drive your business away to some real Shadow IT platform and now you can’t even monitor that.

Governance tools are available - but true governance is People willing to talk

Business and IT not talking to each other is a problem. Here, is an opportunity to solve that. Take your off-shored IT back in-house. Be part of value generation.

If you want partnerships, I will help. There are many in the community that want to help you. Many Power platform champions are literally living this reality and working in this role. Borrow their job template and make it yours, initate the conversation - take it to your manager in business or in IT and say, hey, let’s do this.

I wanted to list a series of tools available. Some has (custom) tag and would need self assembly.

Build tools, build bridges

Disclaimer - I build Power Studio and Power Clarity. The point is, there are tools to provide governance on this platform. This is FAR better than choosing a different tool that IT has no means of providing any meaningful governance.

It would be somewhat easy for me to run purely on fear and say buy “my tools” - they will lock everything down and give you governance. Build a wall. You need a wall. Buy my wall.

If some snake oil salesman comes to you and say that, I want you to understand, real governance is not a wall. There is already enough of a chasm between business and IT.

Real governance is an opportunity to take this platform and transform your apps, yourself, your business and the relationships in your business. It’s hard, potentially very rewarding work.

What do you build your governance for?

Today, governance is a word thrown around without a care of what it actually means. We need to do governance - for what? No that’s all, we just need to do governance.

I wanted to share an article from Paul Culmsee. Those that sees governance as the goal, and not the means to an end, there’s something we all have to let go. Why do we implement governance? What outcome do we desire?

https://medium.com/@paulculmsee/how-to-doom-office365-governance-over-and-over-again-9feede8ef14a

If you have never thought about why you are implementing governance, and you don’t know what your end goal is, then take this quest:

We build governance, because our IT and Business must form a partnership. Our entire governance strategy is to make that partnership work.

The choices are yours, but I think you shouldn’t take forever to think about them

Do the right thing. Chances like this don’t come that often. Don’t look back and think, ah, I didn’t take that opportunity and initiate that conversation, and a decade later, I’m still only a cost center, still fighting shadow IT, and the board still wants to offshore my team.

That’d be unfortunate.

Join us for a free full day Sydney Microsoft App in a Day - June 7

helloquence-61189-unsplash.jpg

Join Microsoft MVPs John Liu and Paul Culmsee - two of Australia’s Power Platform MVPs in Microsoft’s App in a Day event on June 7 right here in Sydney. I’m running this in June with Paul’s Seven Sigma solutions.

Register today for an all-day interactive training to learn how to create custom business applications without writing code, leveraging the Microsoft Power Platform technologies - PowerApps and Microsoft Flow.

App in a Day is designed to accelerate your PowerApps, Microsoft Flow and CDS for Applications experience with a comprehensive training in a single day led by certified Microsoft Partners.

Bring your Windows-based notebook and we will supply the rest, including lunch! *

The training provides practical hands-on experience with Seven Sigma who specializes in creating PowerApps solutions in a full-day of instructor lead app creation workshop.

You will learn how to build custom apps that run on mobile devices, and share them inside your organization securely.

Space is very limited and there’s only two weeks to go - so you need to quickly talk to your colleagues and book at this link.

https://www.microsoftevents.com/profile/form/index.cfm?PKformID=0x67310360001&ch=x3

Upload Image from PowerApps to Flow to SharePoint via an Unused Outlook connector

This is the simplest no code approach to the PowerApps image upload problem so far. Far simpler than with Azure Function, with custom connector, with hacked Flow button via Flow Studio, even simpler than Azure Blob Storage. All standard connectors so no premium required, and no risk of PowerApps trigger resetting and breaking the connection.

This is my simplest method to upload any image from PowerApps to SharePoint

  • No Swagger

  • No Edit JSON

  • No Azure Blob Storage

  • All Standard Connectors

  • No HTTP

  • Can easily add more arguments


Original

This blog post is a cleaned up version of the #Flow Ninja hack 87 thread which happened on Sunday night. https://twitter.com/johnnliu/status/1114863521525669888

Follow me on Twitter and catch the next live hack.


[Updated: 2019-04-27] Video version, PnP SharePoint Community Call from Chaks

From @chakkradeep

This community call demo is taken from the SharePoint General Development Special Interest Group recording on 18th of April 2019. In this video Chaks (Microsoft) shows how you can upload files to SharePoint from PowerApps using Microsoft Flow Presenter - Chakkaradeep (Chaks) Chinnakonda Chandran (Microsoft) - @chakkaradeep Full details on the community call from https://developer.microsoft.com/en-us/sharepoint/blogs/sharepoint-dev-community-pnp-general-sp-dev-sig-recording-18th-of-april-2019/ More details on the SharePoint dev community calls from http://aka.ms/sppnp.


Steps - first a bit of study and exploration

I have a @MicrosoftFlow hack this evening to send files from @PowerApps to @SharePoint I have been thinking about this one for a while. So if you are still awake, follow along.

First - I check the Flow button trigger.
Then create a PowerApps trigger, use peek code to study

Double check SharePoint connector - I read this with FlowStudioApp - there's no method that takes format: byte. Everything wants format: binary.

I spent a while looking through various standard connectors looking for something that does format: byte - I found one. In the Outlook connector.
In send email with attachment. **cackle** **evil grin**

Evil twinkle in the eye acquired - we now execute the plan

So we hack the PowerApps trigger. by using a totally unrelated connector.
I can't hold back my dislike of the PowerApps trigger. Why can't it behave more like the Flow button trigger...

The argument sendanemail_attachmentscontent is ugly. Try using Flow Studio to rename them first before you go too far. This will also make the connection tidier when you take it over to PowerApps.

Finally

PowerApps time - this is probably my simplest method.
Don't need Azure blob storage
Don't need edit json
Don't need swagger
Can have multiple arguments

5-2.png

Just need to conditionally build a strange Flow that doesn't use the outlook connector but use it to lock the PowerApps trigger

  • See the condition is always false - it doesn’t run

  • See also the Size of the create file is much larger than a broken blob string

  • We need to keep the unused Send an email action even if we don’t use it - because it locks the PowerApps trigger in place so the trigger doesn’t reset.


And there we have it - the absolutely simplest no-code solution to send a File from PowerApps to SharePoint with ease.

We lock the PowerApps trigger to format: byte by using an otherwise unused Outlook send mail connector.

Future

There are a few things Microsoft could do that will make this even easier. If they ever get around to it:

  • Allow us to define PowerApps trigger directly either by using Flow Button UI or Request schema

  • Allow SharePoint connector to accept format: byte

  • Allow PowerApps to send format: binary, right now PowerApps converts that to string, dropping the non-character bytes from the data it sends to Flow






Difinity Conference 2019 Auckland - Hackathon Workshop, Flow and PowerApps

I’ll be presenting at Difinity Conference 2019 Auckland on several presentations.

Difinity is the largest Microsoft Data Platform conference in New Zealand. I’ll be presenting two talks - one on Microsoft Flow and one on PowerApps.

dfinity-conf.jpg

Pre-Conf Hackathon/Workshop: Master your inner Flow and PowerApps

This is a whole day workshop covering PowerApps and Microsoft Flow at a beginner to intermediate level, for the Difinity conference - the exercises are tuned for PowerBI integration.

http://difinity.co.nz/pre-conference-workshops-difinity-2019/#CustomConnector

Introduction to PowerApps and Power BI

This session is about two things – it is firstly a thorough introduction about PowerApps, where it came from and where is it going.

And it is also about how the sum is more than the individual parts – when we combine PowerApps and Power BI we can build some truly amazing more interactive reports & dashboards.

How to make everything with Microsoft Flow (advanced)

This is a intermediate-advance level Microsoft Flow session that looks at the very different types of Flow automations that we can do. Whether it is personal automation, enterprise workflows, or developer webservices. Flow is that flexible tool.

Chat!

Those that have met me will know I’m a very chatty person!

I’ll be hanging out at the community booths, so come find me, or tweet me and ask your Flow, PowerApps (or SharePoint) questions!