Skip to content

Commit b92b6bc

Browse files
committed
Guidance docs for Power Automate
Initial set of guidance docs updated for SharePoint connector in Power Automate.
1 parent 28a0038 commit b92b6bc

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Deep dive into ‘Get items’ and ‘Get files’ SharePoint actions in Power Automate
2+
3+
The Get items and Get files SharePoint actions in Microsoft Flow help you get items from a list and a library respectively. Though they are different actions, the capabilities for both the actions are same. In this post, let me take you a deep dive on how to work with these actions.
4+
5+
## Decide if you are working with lists or libraries
6+
To start with, Get items action only works with lists while Get files action only works with libraries. I wanted to reiterate this because I have been misled by this many times wondering why I can’t see my libraries in the Get items action and lists in the Get files action.
7+
8+
## Item limits
9+
The default item limit is 100.
10+
11+
If you are using the default options and just specifying the site address and list/library name, the flow will return 100 items from the list/library.
12+
13+
If you are working with large lists, you can increase this limit up to the list view threshold limit which is 5,000.
14+
15+
To specify the number of items to be returned, expand the advanced options and specify the number in the Top Count action property.
16+
17+
And if you go beyond 5,000 item limit, the flow will fail with the relevant error message.
18+
19+
The items will be paginated as well when you use Apply to each action to the returned item collection if you are wondering about that.
20+
21+
## Limit columns by view
22+
List views are a useful configuration where you can customize what columns to show along with any other conditions or grouping of list items. This is not only useful for users but also for any other computation you want to do over that view data.
23+
24+
With the _Get items_ and _Get files_ actions, you can retrieve the list items along with their columns. However, retrieving the columns would retrieve all the columns. While this is pretty useful, it might be an overkill when you really want to work with a specific set of columns configured in a specific view.
25+
26+
The ‘Limit columns by view‘ option, available in the _Get items_ and _Get files actions_ will allow you to do exactly that. While retrieving list items, you can now limit the columns by view.
27+
28+
Just expand the advanced options in the action and you should see this option. You can select a view of your choice.
29+
30+
This option is useful in cases where you want to perform set of operations on specific data, like in the example above in my flow where I have a view for different events. In the case, where I am working with food events, I might as well limit the columns by the Food Events.
31+
32+
## Filter queries
33+
The action also supports specifying filter queries so you can filter items on the server. Using filter queries are performant than filtering the returned results in your flow.
34+
35+
So, what filter queries can you use? Below are the supported OData filter queries in SharePoint that you can use:
36+
37+
Filter by column name:
38+
39+
```
40+
Location eq 'Midwest'
41+
```
42+
43+
Location is the column name used with the operator equals and ‘Midwest’ is the value of the column.
44+
45+
Other examples:
46+
47+
* Location eq ‘Midwest’ and Status eq ‘Approved’
48+
* startswith(Title, ‘A’)
49+
* startswith(Title, ‘A’) and Due_x0020_Date gt ‘formatDateTime(utcNow(),’yyyy-MM-dd’)’
50+
* formatDateTime(utcNow(),’yyyy-MM-dd’) is an expression
51+
52+
Supported query methods and operators include the following:
53+
54+
### Numeric comparisons
55+
* lt
56+
* less than
57+
* le
58+
* less than or equals
59+
* gt
60+
* greater than
61+
* ge
62+
* greater than or equals
63+
* eq
64+
* equals
65+
* ne
66+
* not equal
67+
68+
### String comparisons
69+
* startsWith
70+
* substringOf
71+
* eq
72+
* ne
73+
74+
### Date and time functions
75+
* day()
76+
* month()
77+
* year()
78+
* hour()
79+
* minute()
80+
* second()
81+
82+
## Order by query
83+
You can also specify an order by query so you can order items based off of a column either in ascending or descending order. The query is really simple, for example:
84+
85+
* Due_x0020_Date desc
86+
* Title asc
87+
88+
Note that spaces in the column name are replaced with `_x0020_` (0 is numeral zero).
89+
90+
The format is column name followed by asc or desc depending on ascending or descending order respectively.
91+
92+
## Lookup columns support
93+
If your list/library has lookup columns, Get items and Get files actions support returning items with a maximum of 12 lookup columns, excluding the out of the box Created by and Modified by fields. If your list/library exceeds this threshold, the flow will error out.
94+
95+
Lookup columns are also not supported today in both filter by and order by queries in the action. These will include fields such as person fields, lookup columns to another list, taxonomy fields etc.,
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Working with the SharePoint Send HTTP Request Power Automate action
2+
3+
The SharePoint Send HTTP Request flow action allows you to construct and execute SharePoint REST API queries. This action is particularly useful in the cases when the existing SharePoint flow actions do not suffice the need or just that the action you are looking is not available yet in the SharePoint connector.
4+
5+
Below are some of the tips on how to work effectively with the SharePoint Send HTTP Request action.
6+
7+
> Note: This is a developer focused action and hence you will need to understand how SharePoint REST API works and also how to parse JSON strings in Microsoft Flow.
8+
9+
## Get to know the SharePoint REST/OData APIs
10+
SharePoint has many APIs. The one we are interested in is the REST/OData APIs. You can find the complete set of REST/OData APIs [here](https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service#bk_learnmore).
11+
12+
Though you can use the SharePoint 2010 REST APIs (_vti_bin/listdata.svc) in some cases, it is recommended to use REST/OData APIs instead.
13+
14+
## Use JSON light
15+
SharePoint REST/OData APIs support [JSON light](https://www.microsoft.com/en-us/microsoft-365/blog/2014/08/13/json-light-support-rest-sharepoint-api-released/). This means that you can set headers in your API request that will tell SharePoint whether to include any metadata in the response. In many cases, you will not require the metadata. It just makes things easier to parse the output of the action.
16+
17+
To do this, just add the following header:
18+
19+
```
20+
Accept: application/json; odata=nometadata
21+
```
22+
23+
## Parsing the response
24+
If you execute a GET request, then you most probably want to parse the response. Good thing is that the default response is JSON and that makes things easier.
25+
26+
You can do that by querying the body of the action and then parsing through the JSON array or object depending on your response.
27+
28+
You can easily build an expression to do that:
29+
30+
```
31+
body('Send_an_HTTP_request_to_SharePoint' )['Id']
32+
```
33+
34+
In cases where you have an array, then you have a JSON array object. You can use the above expression but then construct an apply to each action and use the following expression to input the variable to work with.
35+
36+
```
37+
body('Send_an_HTTP_request_to_SharePoint' )['value']
38+
```
39+
40+
Inside the apply to each action, you can then access the individual elements with the following expression:
41+
42+
```
43+
items('Apply_to_each')['Title']
44+
```
45+
46+
## Accessing all dynamic content
47+
Since the fields in the SharePoint HTTP Request action are text fields, the flow designer filters the default items in the Dynamic Content to be of string properties.
48+
49+
To get the non-string properties, all you need to do is click See more for that action in the Dynamic Content and you will see all the non-string properties as well.
50+
51+
This is particularly useful when you want to build queries where you need to pass the ID of an item which is a number and not a string.

0 commit comments

Comments
 (0)