PowerApps Pro Tips | Patching SharePoint Lists

by AllisonCaldwell ‎05-01-2017 11:49 AM - edited ‎05-02-2017 06:06 AM

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.

 

Read Evan Chaki's original post on the Confluent blog, or keep reading below.

 

 

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:

  1. The @odata type (which you can find by using the Gallery trick);
  2. the Value (a dropdown in PowerApps); and
  3. 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.

Comments
by lcncoccia
on ‎06-16-2017 01:55 PM

I need to connect to sharepoint list, bat I need to download and upload Attacchment document (standard Attacment on sharepoint list). But unfortunally I haven't found object in Powerapps to do that easy. Can you help me.

 

 Best Regard

Luciano 

by KarlHoffmaster
on ‎06-16-2017 02:21 PM

Luciano, 

currently, image upload is not an available function in the current version of PowerApps for SharePoint data sources.  However, in the next release (660), it will be an option.

 

This should be out in about 3 weeks. 

by lcncoccia
on ‎06-16-2017 02:33 PM

Thank you very much for your replace, In reality I need to up load document (drawing, Exel file, Windoc, Exc.) in sharepoint there is Athacchment object and you can put on wath you want, I hope the new object in PowerApps can connect on this standard sharepoint object.

 

Best regard

Luciano

 

by lcncoccia
on ‎06-16-2017 02:38 PM

In attachment an example.

 

 

 

Capture.PNGUntitled.png

About the Author