The SharePoint connector in PowerApps is extremely useful to mobilize your workforce and give them access to SharePoint data on the move. If you allow PowerApps to auto-create an app from your list, it’s a simple process to create, edit, and delete new items from that list. If you have a business need to create a custom app and send data to your SharePoint lists, however, there are a few steps you’ll need to take.
Determine Your Field Types
The first step will be to understand what field types are in your SharePoint list and what you want to do with them. If you have a single line of text fields, then your patch statement will be easy. Just remember to patch the title every time when you do an insert or an update.
Go to your SharePoint list settings and look at the types of columns you have. You’ll need to know what each type is when you’re ready to create or edit each column.
Here are the common columns that you can do a normal patch to:
- Date and Time
- Single line of text
- Yes / No
These column types require a little more work:
- Person or Group
- Choice
- Lookup
For these column types, you must patch a record inside of your record for the insert or update to work. There’s a special column type called “@odata” that you’ll need to pass over.
A simple trick that we use at Confluent is to create a Gallery on a blank page, and pull back a set of records from the SharePoint list. Using the gallery, you can quickly see what items need to be passed to get the patch to work.
Example 1 – Choice Box
You have a column called “System Type” in SharePoint, and it is a Choice column.
When you want to patch these column back to your SharePoint list, you’ll need a Patch statement that looks like this:
First check to see if you have an internet connection, then set up your patch statement to your SharePoint list. After that, do an update to your SharePoint list to update the record based on the Record ID in SharePoint.
Notice the System Type. To do the update, you’ll need to pull the SharePoint backend field name “System_x0020_Type” (not the display name you see in the SharePoint UI). To the right of that, you need to pass in a record {}. In this example, we’re going to pass three items as that record:
- The @odata type (which you can find by using the Gallery trick);
- the Value (a dropdown in PowerApps); and
- an ID.
We have found that you can pass one each time, and the drop-down will update. This might change in the future. If you can, build your drop-down box in PowerApps to list the ID and the name in the drop-down, and pass the ID to this.
Example 2 – Person or Group Lookup
To patch over a person you will follow the same steps. More items are needed for the person to create in SharePoint correctly, but the key is the email address. If you pass the email address, SharePoint will do the rest. Again, this could change in the future, but right now it works.
In this example, look at the @odata type you need to pass from your test gallery. Then use the email address that you populate into a hidden text box in order to pass that over into the Claims, DisplayName, and Email.
It takes a little more trial and error to build the PowerApps SharePoint connection, but this should help.
[divider line_type=”Small Line” custom_height=”20″]