Create Collection from SharePoint List in PowerApps

In this Power Apps Tutorial, we will discuss how to create a PowerApps Collection from a SharePoint List.

Also, we will cover these below topics that are related to PowerApps Collection to SharePoint List:

  • PowerApps create collection from SharePoint List
  • PowerApps SharePoint list to collection
  • PowerApps create collection from datasource
  • PowerApps create collection from SharePoint list column
  • PowerApps collection SharePoint list filter
  • PowerApps collect SharePoint list attachments
  • PowerApps collect SharePoint choice column
  • PowerApps collect SharePoint list column
  • PowerApps collect SharePoint list person field
  • PowerApps collection SharePoint list limit
  • PowerApps collect large SharePoint list
  • PowerApps collection update SharePoint list

If you want to create a collection from an excel in Power Apps, check out how to create PowerApps Collection from Excel.

Create Collection from SharePoint list PowerApps

  • As from my previous post i.e. PowerApps Collection create and use, you must be learned that what is a PowerApps Collection and how to create a collection in PowerApps.
  • Now we will see how we can create a PowerApps Collection from SharePoint list. To achieve this, we need to follow these below basic steps:
  1. Create a SharePoint List and insert some records into it
  2. Create a new blank canvas app in PowerApps
  3. Connect a new or existing Sharepoint Data source and add the SharePoint list
  4. Insert a PowerApps Button input and apply the List Collections code
  5. Save and Preview the app and then tap the button
  6. View the SharePoint List items i.e. added into the PowerApps Collections

Syntax: Create PowerApps Collection from SharePoint List

You can refer to the below syntax to create a PowerApps collection from the SharePoint list.

Collect(CollectionName, YourListName)

Where,

  1. Collect = This is the collection function Name that is used to create Powerapps Collections
  2. CollectionName = Specify a collection name
  3. YourListName = Provide the SharePoint List Name that contains the records that you wants to display in the Powerapps Collections

Now we will start the step by step process:

  1. Create a SharePoint List and insert some records into it
  • At first, you need to create a SharePoint list on your SharePoint site. And also, you have to insert some new records into it.
  • The below screenshot represents a SharePoint List named Products. This list has some different data types of fields and as well as some records as shown below.
Create Collection from SharePoint list PowerApps
Create Collection from SharePoint list PowerApps

2. Create a new blank canvas app in PowerApps

  • Sign in to the PowerApps app with your credentials.
  • Go to the Apps section from the left navigation.
  • Select Canvas under the + New app tab from the top of the page.
PowerApps Collection from sharepoint list
PowerApps Collection from sharepoint list
  • Enter the name of the app and select the Tablet layout under the Format section. Then hit on the Create button as like the below screenshot.
powerapps collect sharepoint list

3. Connect a new or existing Sharepoint Data source and add the SharePoint list

  • Next, you need to connect the SharePoint List data source and then add the created SharePoint List to PowerApps.
  • Go to the Data tab (from the left navigation pane) -> click on +Add data -> Search SharePoint in the search box as shown below.
  • If there is an existing SharePoint connection, then you can use it directly otherwise you will create a new SharePoint connection by using the “+ Add a connection” option.
powerapps create collection from datasource
powerapps create collection from datasource
  • Then, select the SharePoint site and as well as choose the SharePoint list (Products). At last click on the Connect button.
powerapps collection sharepoint list
  • Now the SharePoint list (Products) is ready to use in the app as shown below.
power apps collection sharepoint list
power apps collection sharepoint list

4. Insert a PowerApps Button input and apply the List Collections code

  • On the PowerApps screen, insert a Button control and rename it to Add SP List Items to Collection. Also, you can provide some properties to the button like Background color, Font size, Font text etc.
  • Select the button and apply the below formula on its OnSelect property as:
OnSelect = Collect(colSPListItems, Products)

Where,

  1. colSPListItems = Name of the collection
  2. Products = SharePoint list name
powerapps create a collection from sharepoint list
powerapps create a collection from SharePoint list

5. Save and Preview the app and then tap the button

  • Now save, publish, and preview (F5) the app. Just tap on the button. When you will press on to it, then the collection will create and add all the SharePoint list records into it.
powerapps sharepoint list to collection
powerapps SharePoint list to collection

6. View the SharePoint List items i.e. added into the PowerApps Collections

  • To view the SharePoint List collection, go to the View tab -> click on Collections as like below.
powerapps collection to sharepoint list
  • Once you will click on the collection name (colSPListItems), you can see all the SharePoint list records inside the created collection as shown in the below screenshot.
power apps collection to sharepoint list
PowerApps SharePoint list to collection

That’s how you can create a collection from SharePoint List in PowerApps.

See also  Power Apps Modern Checkbox Control [How to Use]

PowerApps create collection from datasource

To work around with the PowerApps create a collection from the data source, you can check out PowerApps create collection from datasource to get some ideas.

PowerApps create collection from SharePoint list column

Here we will see how PowerApps create a collection from the SharePoint list column.

  • Suppose there is a SharePoint List and it has some various columns. Next, you would like to display some of the SharePoint List columns in a PowerApps collections. So check out the below formula to achieve it.
  • Here, I have taken the same above SharePoint List (Products). Now I would like to display only the Vendor (Choice Data type) and CustomerName (Single line of text Data type) column in the PowerApps Collections.
  • Add a Button control and rename it to View Column from Collections. Select the button and apply the below code on its OnSelect property as:
OnSelect = ClearCollect(
    colProducts,
    ShowColumns(
        Products,
        "Vendor",
        "CustomerName"
    )
)

Where,

  1. colProducts = Specify the Collection name
  2. ShowColumns = PowerApps ShowColumns function includes columns of a table and drops all other columns
  3. Products = SharePoint List Name
  4. “Vendor” = SharePoint List Choice column name
  5. “CustomerName” = SharePoint List Singe line of text column name
PowerApps create collection from SharePoint list column
PowerApps create collection from SharePoint list column
  • Please note that the column names must be enclosed in double-quotes. Also please be aware that these functions are not delegatable, so if your list is >2000 items, you will run into problems with them when you create the collection unless you filter the list down to <2000 items.
  • Now save and preview the app. Once you will open the collections (View -> Collections), then you can view the result as shown like the below screenshot.
create collection in powerapps from sharepoint list

This is how we can work with PowerApps to create a collection from the SharePoint list column.

PowerApps collection SharePoint list filter

In this scenario, We will discuss how to filter a PowerApps collection from the Sharepoint List. Let’s take some different scenarios.

Scenario – 1:

  • I have a SharePoint list named Blog Sites. This list has six columns with different data types:
  1. Title = By default this is a single line of text data type
  2. Site URL = This is also a Single line of text data type field
  3. Site Rank = Single line of text data type column
  4. Active Or Inactive = This is yes/no field
  5. Site Work = Single line of text data type column
  6. Created By = By default, This is a person field

Refer to the below screenshot.

PowerApps collection SharePoint list filter
  • Now I would like to create a PowerApps collection from the SharePoint List where it will filter only the records of the current logged in user. That means, suppose I am the current logged in user, then my records only visible to me. I can not see others records in the app.
  • To workaround with this, insert a Button control and as well as a Gallery control to the screen. Rename the button control to Click Me! as shown below.
Power Apps collection SharePoint list filter
  • Next, select the button and set its OnSelect property to the below code:
OnSelect = ClearCollect(
    AllMyData,
    Filter(
        'Blog Sites',
        Lower('Created By'.Email) = Lower(User().Email)
    )
)

Where,

  1. AllMyData = Specify a Collection name
  2. ‘Blog Sites’ = SharePoint List name
  3. Lower = This function helps to convert a string of text from uppercase to lowercase. To know more details about this function, refer to this article PowerApps Lower, Upper, and Proper function
  4. ‘Created By’ = SharePoint list person field name. Here you need to specify .Email parameter.
SharePoint list filter in PowerApps collection
SharePoint list filter in PowerApps collection
  • Now select the gallery control and set its Items property to the collection name i.e.
Items = AllMyData
SharePoint list filter PowerApps collection
SharePoint list filter PowerApps collection
  • Save and preview the app. When you will click on the button, in the gallery, you will see all the records that have been created by you only (current logged in user) as in the below screenshot.
  • Also, you can view the filter records in the created collections section as well named AllMyData.
PowerApps collection SharePoint list column filter

This is how to work with the PowerApps collection SharePoint list filter.

Scenario – 2:

  • In this scenario, I would like to filter the SharePoint list Yes/No field and the filtered records will display in a PowerApps Collections.
  • In the below screenshot, When you will press the button (Hit Me), then it will filter the SharePoint boolean field records that contain only the Yes values.
how to create a collection in powerapps from sharepoint list
  • The below screenshot represents the same SharePoint List (Blog Sites) that I have used in the above scenario. Among all the fields, it also has a boolean field named Active Or Inactive. In the collection, the SharePoint list will filter and it will only display the True values.
powerapps create collection sharepoint list column filter
powerapps create collection sharepoint list column filter
  • To do this, apply the below code on Button’s OnSelect property as:
OnSelect = Collect(
    colBoolData,
    Filter(
        'Blog Sites',
        'Active Or Inactive' = 1
    )
)

Where,

  1. colBoolData = Specify a collection name
  2. ‘Blog Sites’ = Specify the SharePoint List name
  3. ‘Active Or Inactive’ = SharePoint List Yes/No field name. You need to specify the numeric number as 1 to get all the true values from the SharePoint List.
power apps collection sharepoint list column filter
  • Next, insert a Data table and set the collection name on its Items property as:
Items = colBoolData
powerapps collections sharepoint list column filter
PowerApps collection SharePoint list filter
  • Save and preview the app. When you will click on the button, you can see all the true values in the data table control.
See also  How to Count Rows in Power Apps Collection?

To work with Power Apps Filter from SharePoint List, you can check out the tutorial on PowerApps Filter SharePoint List

PowerApps collect SharePoint list attachments

  • Sometimes you may think that can PowerApps Collections have attachments? Or is there any way to view an attachment in a PowerApps Collections? Overall, Do you want to pull the SharePoint List attachments into a collection using the ClearCollect function?
  • Coming to its answer is if you want to pull the SharePoint List attachments into a collection using the ClearCollect function, I afraid that there is no way to achieve your needs within PowerApps currently.
  • Alternatively, We could only access the SharePoint List item attachments within the Attachments control of an Edit form. For more details about the attachment control, you can check out the PowerApps tutorial on PowerApps Email Attachment Control – How to Use

PowerApps collect SharePoint choice column

Do you want to work with the SharePoint Choice column in PowerApps Collection? Check out the below scenarios to get details.

Scenario – 1:

  • In this scenario, I have a SharePoint list named Products. Among all the various fields, there is a Choice column called Vendor.
  • This Vendor column has some choice values like APPLE, DELL, HP, SAMSUNG, etc. Now I would like to create one collection that will display only the SharePoint choice values.
Power Apps collect SharePoint choice column
Power Apps collect SharePoint choice column
  • To do this, insert a button control and rename it to Get SharePoint Choices. Then, apply the below formula on its OnSelect property as:
OnSelect = ClearCollect(
    colChoices,
    Choices(Products.Vendor)
)

Where,

  • colChoices = Collection Name
  • Products = SharePoint List Name
  • Vendor = SharePoint Choice column name
PowerApps collect SharePoint choice column
  • Save and Preview (F5) the app. Tap on the button (Get SharePoint Choices) and then go to the Collections (View -> Collections). When you will open the specific collection, you can see all the SharePoint Choice values as shown below.
PowerApps collection SharePoint choice column

Scenario – 2:

  • For this scenario also, I will take the same above SharePoint List (Products) and the same Choice field named Vendor.
  • Here I would like to filter the SharePoint choice column and display the vendor value that contains only APPLE values. All the filtered records will store in a PowerApps Collections.
  • To work around with this, add a Button control and rename it to Click and Get SP Choices. Set the below code on Button’s OnSelect property as:
OnSelect = ClearCollect(
    colProdChoices,
    Filter(
        Products,
        "APPLE" in Vendor.Value
    )
)

Where,

  1. colProdChoices = Specify the collection name
  2. Products = SharePoint List name
  3. APPLE” = Specify the choice value that you want to filter
  4. Vendor = SharePoint Choice column name. Here you need to specify .Value parameter.
SharePoint choice column in PowerApps collections
  • Save and Preview (F5) the app. Click on the button. Now go to created collections (colProdChoices). Here you will get all the APPLE value details as like the below screenshot.
PowerApps collections SharePoint choice column

NOTE:

If the SharePoint Choice column is not multiple-choice, then, in that case, you can try these below formulas:

  • Insert a Gallery control and set its Items property to the below code:
Items = AddColumns(Products, "NewValues", Vendor.Value)
  • Then, create a button and set its OnSelect property to the below code:
OnSelect = ClearCollect(colProducts,Filter(Gallery1.AllItems, NewValues= "APPLE")

This is how we can work with PowerApps collect SharePoint choice column.

PowerApps collect SharePoint list column

Here we will see how to work with the PowerApps collect SharePoint list column. Let us discuss a simple scenario.

  • Suppose there is a SharePoint List with various types of fields. Among them, you want to view some of the fields (may be two or three) in the PowerApps Collections. That means except some fields, you do not want to view all the SharePoint List fields in the collections.
  • From the below SharePoint list named TSInfo Attachments, I want only two column values i.e. Title and Attachment Types. Title is a Single line of text data type and Attachment Types is a Choice column.
PowerApps collect SharePoint list column
PowerApps collect SharePoint list column
  • To workaround with this, add a Button control (Click me) and set its OnSelect property to the below code:
OnSelect = ClearCollect(
    colSPValues,
    ShowColumns(
        'TSInfo Attachments',
        "Title",
        "AttachmentTypes"
    )
)

Where,

  • colSPValues = Name of the collection
  • TSInfo Attachments = SharePoint List name
  • Title“, “AttachmentTypes” = These are the column names that I want to view in the collections
Power Apps collect SharePoint list column
Items = colSPValues
PowerApps collections SharePoint list column
PowerApps collections SharePoint list column
  • In the data table control, you need to add these both fields by using the Edit fields section. Once you added those two fields, you may face error in one field due to the SharePoint Choice field.
  • For the SharePoint Choice field, you need to specify its Text property as:
Text = ThisItem.AttachmentTypes.Value

Refer to the below screenshot.

Power Apps collection SharePoint list column
  • At last, save and preview the app. When you will click on the button (Click me), then all the records will display in the data table as like the below screenshot.
PowerApps collection SharePoint list column
PowerApps collection SharePoint list column

PowerApps collect SharePoint list person field

Do you ever want to collect email addresses from the Person column in Sharepoint List? It’s very simple. Check out the below scenarios.

See also  How to Use Power Apps Gallery OnSelect?

Scenario – 1:

  • There is a SharePoint List named Book Purchase Info. This list has a People picker or Person field called Book Seller. Now I would like to collect all the email address from the Sharepoint List Person field. The list has some records as shown below.
PowerApps collect SharePoint list person field
  • To do this, take a Button control (Hit Me!!) and set the below code to its OnSelect property as:
OnSelect = ClearCollect(
    colEmail,
    ShowColumns(
        AddColumns(
            'Book Purchase Info',
            "Email",
            BookSeller.Email
        ),
        "Title",
        "BookPrice",
        "Email"
    )
)

Where,

  1. colEmail = Collection name where all the Email will store
  2. AddColumns = PowerApps AddColumns function helps to add a column to a table. To know more details about AddColumns function, refer to the article: PowerApps AddColumns Function with Examples
  3. ‘Book Purchase Info’ = SharePoint List name
  4. Email” = Enter new column name where the email will store
  5. BookSeller = SharePoint Person field name
  6. Title“, “BookPrice“, “Email” = SharePoint field names
Power Apps collect SharePoint list person field
Power Apps collect SharePoint list person field
  • Save and Preview the app. Click on the button and then go to the Collections that you have created (colEmail). There you can able to view all the person emails in the Email field as like the below screenshot.
PowerApps collection SharePoint list person field

Scenario – 2:

  • In the below screenshot, you can see there are multiple people present in a single SharePoint List item. Now I would like to view all the email addresses individually within a PowerApps Collection.
PowerApps collection SharePoint list person column
  • To achieve this, insert a Button control (Click to collect SP People) and apply the below formula on its OnSelect property as:
OnSelect = ClearCollect(
    colSPPeople,
    Ungroup(
        'Book Purchase Info',
        "BookSeller"
    )
)

Where,

  1. colSPPeople = Specify the collection name
  2. Ungroup = PowerApps Ungroup function helps to break into separate records that were grouped together
  3. ‘Book Purchase Info’ = SharePoint list name
  4. “BookSeller” = SharePoint Person Field name
PowerApps collection SharePoint list people picker
PowerApps collection SharePoint list people picker
  • Save and Preview the app. Click on the button i.e. Click to collect SP People and then go to the Collections (colSPPeople). Here, you can able to view all the email addresses separately as shown below.
PowerApps collection SharePoint list people picker field

This is how to work with PowerApps collect SharePoint list person field.

PowerApps collection SharePoint list limit

  • As you know, everything has a certain limit in PowerApps. Similarly, PowerApps Collection items have certain limits. If the item crosses beyond its limit, then you will see a warning issue. This issue is known as the PowerApps Delegation issue.
  • Do you worry about Delegations issues in PowerApps Collection? Also, if you want to know how to overcome this issue, then follow the below link to get all the details on PowerApps Collection SharePoint list limit

PowerApps collect large SharePoint list

Suppose in case, your SharePoint list is having more than 3000 records. But unfortunately, the PowerApps collection limit is only 2000 records. Then in that case what you will do to resolve the issue? You can check out PowerApps collect a large SharePoint list to overcome this type of issue.

PowerApps collection update SharePoint list

Do you want to update the SharePoint list from the collection itself? If so, then you can refer to the article on PowerApps collection update SharePoint list

Also, if you want to update the items in the PowerApps collection, then check out a tutorial on How to Update collection item in PowerApps

Also, you may like these below PowerApps Tutorials:

In this Power Apps Tutorial, we discussed how to create a PowerApps Collection from the SharePoint List.

Also, we covered these below topics that are related to PowerApps Collection to SharePoint List:

  • PowerApps create collection from SharePoint List
  • PowerApps SharePoint list to collection
  • PowerApps create collection from datasource
  • PowerApps create collection from SharePoint list column
  • PowerApps collection SharePoint list filter
  • PowerApps collect SharePoint list attachments
  • PowerApps collect SharePoint choice column
  • PowerApps collect SharePoint list column
  • PowerApps collect SharePoint list person field
  • PowerApps collection SharePoint list limit
  • PowerApps collect large SharePoint list
  • PowerApps collection update SharePoint list
  • Hello, i would like to know how to make an item deleted automatically from a sharpoint list when it is removed from a collection ?

  • Thank you for the walkthrough. When I do this though it renames all of my columns to Field_1, Field_2, … I can’t seem to retain the column names.

  • >