前言
通过Power Automate获取SharePoint数据时候,有时候需要获取最近两天更新的数据,这时候就用到了SharePoint Rest API,下面将介绍两种方式来获取最近两天更新的数据
1、SharePoint Caml Query
- 设置前两天日期变量
substring(addDays(utcNow(),-2),0,10)
- 设置rest api及caml query语句
标头: { "Content-Type": "application/json;odata=verbose", "Accept": "application/json;odata=verbose" } Rest API: /_api/web/lists/GetByTitle('@{variables('ListName')}')/RenderListDataAsStream Caml Query: { "parameters": { "__metadata": { "type": "SP.RenderListDataParameters" }, "AddRequiredFields": "true", "DatesInUtc": "true", "ReplaceGroup": "true", "AllowMultipleValueFilterForTaxonomyFields":"true", "RenderOptions": 1183751, "ViewXml": "<View Scope='RecursiveAll'><Query><Where><And><Eq><FieldRef Name='FSObjType'/><Value Type='Integer'>1</Value></Eq><Geq><FieldRef Name='Modified' /><Value Type='DateTime'>@{variables('StartDate')}</Value></Geq></And></Where></Query><RowLimit Paged='TRUE'>500</RowLimit></View>" } }
2、Rest API Filter
- api filter
Status eq 1 and StartDateTime le datetime'@{substring(utcNow(),0,10)}T15:59:59Z'