Blog

Powerautomate Caml Query

On 27/05/2021

Powerautomate Caml Query

Camlquery

Powerautomate Add Comment To ListItem

On 27/05/2021

Add comment to ListItem with powerautomate (http Sharepoint request)

Addcommentonitem

PowerAutomate Update ListItem HTTP REST

On 27/05/2021

Update a list item with http request with powerautomate

Updateitem 1

 

 


{
  "Accept": "application/json; odata=verbose",
  "content-type": "application/json; odata=verbose",
  "X-HTTP-Method": "MERGE",
  "If-Match": "*"
}


 

 

Add WebPart On Modern Page PNP Powershell

On 07/05/2021

Add custom WebPart On Modern Page Powershell

 

List your webpart with :

$page = Get-PnPPage -Identity "aTestDisp2.aspx"

$page.AvailablePageComponents() select your webpart by name or guid

Listwp 1


param([string]$siteUrl="https://myyTenant.sharepoint.com/sites/muSite", [string]$pageName="aTestDisp2", [string]$webPartName="Test - Display Item")
clear
Connect-PnPOnline -Url $siteUrl -UseWebLogin
#set your wenpart properties
$wpProps = @{webUrl="https://myyTenantsharepoint.com/sites/muSite"
            listId="b4d5f780-bd74-4cd5-b051-fed423e43125"
            field="Title"
            itemId="1"}

#get the page
$page = Get-PnPPage -Identity $pageName

# get the target webpart
$wp = $page.AvailablePageComponents() | Where-Object {$_.Name -eq $webPartName }
if($wp -eq $null)
{
    Write-Host "webpart '$($webPartName)' not found " -ForegroundColor:Red
}
#Add webpart with default user, to column 1 in section 1
Add-PnPPageWebPart -Page $pageName -Component $wp -Section 1 -Column 1 -WebPartProperties $wpProps
Disconnect-PnPOnline

 

You can check webpart properties, in result

Wpresults

Get Sharepoint List Items Count

On 02/04/2021

Get Sharepoint list Items count


var xhr = new XMLHttpRequest();
console.clear();
var url = "https://mySiteUrl";
xhr.open('GET', url + "/_api/web/Lists/getbytitle('TheListName')?$select=ItemCount,Title");

xhr.setRequestHeader("Accept", "application/json; odata=verbose");
 
xhr.onload = function () {
	if (xhr.status === 200) {
		var kk = JSON.parse(xhr.responseText);
		console.dir(kk.d.Title + " Item Count : " + kk.d.ItemCount);
	}
	else {
		console.dir(xhr);
		alert('Request failed. Returned status of ' + xhr.status);
	}
};
xhr.send();

In your browser you must be your your site url, push key F12 paste above code in console, en push enter

Listitemscount

fr

Power Automate Sharepoint Actions List

On 31/03/2021

Power Automate Sharepoint Actions List

PoactionsPoactions2

Powerautomate Extract Data From Json Array

On 31/03/2021

Powerautomate Extract Data From Json Array

 


{
	"fieldsMapping":[
		{
			"sourceFieldName": "Title2",
			"sourceFieldTypeAsString": "Text",
			"targetFieldName": "Title",
			"targetFieldTypeAsString": "Text"
		},
		 {
		  "sourceFieldName": "Title",
		  "sourceFieldTypeAsString": "Text",
		  "targetFieldName": "OtherTexteField",
		  "targetFieldTypeAsString": "Text"
		}
	]
}

Currentdata

items('Appliquer_à_chacun')?['sourceFieldName']

this command above will put sourceFieldName value in CurrentDataName variable

Datafromjsonarray

this command above will put sourceFieldName value in CurrentDataName variable

PowerAutomate Goodies

On 31/03/2021

Power Automate goodies

 

Add a cont JSON to store urls and lists names for example

 


{
	"sourceUrl": "https://mySite/sites/DevSpFX/LRemy",
	"sourceListeName": "listeSource",
	"sourceListItemEntityTypeReq":"/_api/web/lists/getbytitle('listeSource')/?$select=ListItemEntityTypeFullName",
	"sourceListItemEntityTypeFullName":"null",
	"sourceListQuery":"/_api/Web/Lists/getbytitle('listeSource')/items?select=Title,myUser1,myChoice1,Title2",
	"targetUrl": "https://mySite/sites/DevSpFX/LRemy",
	"targetListItemEntityTypeReq":"/_api/web/lists/getbytitle('listTarget')/?$select=ListItemEntityTypeFullName",
	"targetListItemEntityTypeFullName":"null",
	"targetListeName": "listTarget",
	"targetListeRequest": "/_api/Web/Lists/getbytitle('listTarget')/items",
	"logListRequest": "/_api/Web/Lists/getbytitle('logs')/items",
	"fieldsMapping":[
		{
			"sourceFieldName": "Title2",
			"sourceFieldTypeAsString": "Text",
			"targetFieldName": "Title",
			"targetFieldTypeAsString": "Text"
		},
		 {
      "sourceFieldName": "Title",
      "sourceFieldTypeAsString": "Text",
      "targetFieldName": "OtherTexteField",
      "targetFieldTypeAsString": "Text"
    }
	]
}

Add a JSON analyser action (above json is juste an exemple)

Addjsonaction

 

Add your JSON in generate from sample, this will create an object that you can use later

Ehantillon 1

Then add your JSON datas (if you modify JSON structure, you must regenerate the sample)

Addcontentjson

Use you Const to get items

Addconstinaction