Créer un site internet

Power plateform

Include PowerApps, Power automate flow

PowerApps Functions

By On 30/09/2022

PowerApps functions

Parse text to number

    Filter('Workflow Tasks'; ID = Value(txtId.Text))

Add datas (listItem)

    Patch(NewVoie;Defaults(NewVoie);{Num_x00e9_rovoie:"0"&LookUp(NewVoie;ID=1).Num_x00e9_rovoie}))

Update context, and forms datas

    SubmitForm(FormBeneficiaires);;ResetForm(FormBeneficiaires);; NewForm(FormBeneficiaires);; UpdateContext({showPopup:false});

Navigate to another form

    Navigate(Page_infos_enregistrements)

Get query string parameter and set a variable

    Set(InitiativeId; Param("ID"))

Getquerystringparam

 

Get a field from your datasource by ID

    First(Filter(Initiatives; ID=1)).Nom

 

And Or Not

Or(And(Radio1.Selected.Value=4; !IsBlank(txtComment.Text));Radio1.Selected.Value<4)

 

Update Lookup Field

Patch(
        ResultatAnalyses;
        First(//here item to update
            Filter(
                ResultatAnalyses;
                Affaire.Id = currentAffaire.ID And Analyse.Id = ThisItem.ID
            )
        );
        {
            Title: "notused";
            Commentaires: txtGalComment.Text;
            Gravite: Rating1.Value;
            Affaire: {//lookup field name
                Id: currentAffaire.ID;//id of lookup
                Value: LookUp(
                    Affaires;//list who contains lookup value
                    ID = currentAffaire.ID;//id of lookup
                    currentAffaire.Title//title of lookup value
                )
            }
        }
    )

Patch Choice

TypeIntervention: {Value: dtvTypeIntervention.Selected.Value}

Execute automate with json

'My workflow'.Run(
	JSON(
		{
			SolutionId: selectedSolution.ID,
			ImageContent: UploadedImage14.Image
		},
		JSONFormat.IncludeBinaryData
	)
);

Reg ex to get cleaned string

Clear(AttachmentsCollection);
ForAll(
      RenameColumns(DataCardValue91.Attachments, "Name", "Name1"),
      Collect(
             AttachmentsCollection,
             Name1
      )
);Set(Title1, First(AttachmentsCollection).Value);Set(FileName1, Concat( Split(First(AttachmentsCollection).Value, "" ), If( IsMatch(Result, "([^A-Za-z0-9\.\-])" ), "",Result ) ))

Save Form

SubmitForm(Form1);;If(!IsBlankOrError( Form1.Error); Notify("Une erreur est survenue lors de la sauvegarde " & Form1.Error; NotificationType.Error);Notify("La savegarde a réussi";NotificationType.Information);;Set(currentElement; Form1.LastSubmit))

 

Sort columns


Set(Month, Distinct(SortByColumns(CurrentMonthMails, "Year", Ascending, "Month", Ascending), Month))

Set date


Set(StartDate, DateAdd(DateTimeValue( Day(Today) &"/"& Month(Today) &"/"& Year(Today) &" 00:00:00"), -30));

Sum


Sum(Filter(CurrentMonthMails, Month = ThisItem.Result ), uniqMails)

 

Power Automate Get DriveId For Excel "Get tables"

By On 16/04/2024

Here i will show you how to get an Excel File from SharePoint dynamicaly

 

01 flowgetdriveid

/_api/v2.1/drives?$select=id,webUrl&$filter=webUrl eq 'https://myTest/sites/Site1/doclib1'

body('Send_an_HTTP_request_to_SharePoint')['value'][0]['id']

02 flowgettable

Power Automate We are unable to find the site address. Please try selecting a site address from the dropdown.

By On 24/10/2023

Power Automate, cannot access to my site

We are unable to find the site address. Please try selecting a site address from the dropdown.

If you don't found your site in dropDown list or your site cannot be used

you can add you url manually in custom value, then you cannot select a list, but you can set id id of the list and it will work

01 selectyoursite

 

 

 

get the id in your list when you navigate in your list setting

SKIP %7B and %7D

02 getidoflist

 

03 setlistid 1

 

 

 

 

 

 

 

 

Save and it should be ok

The list ID should be replaced by the correct list title

04 listsetted 1

Prevent Recursive Update

By On 24/10/2023

How to prevent recursives update on trigger "When an item is created or modified"

 

add this in trigger settings, set your email (a service account) thaht will not launch the trigger

@not(equals(toLower(triggerOutputs()?['body/Author/Email']), 'service_account@test1.com'))

 

so with this settings you can perform an update in your flow without recursive trigger

 

Preventrecursiveupdate

PowerAutomate history Unexpected Error Unable To Fetch

By On 21/04/2023

PowerAutomate history - Unexpected error. Unable to fetch

WfhistoryerrorI my case to solve this issue, i press "ctrl + R" then "ctrl + F5", then i should wait a few minutes before opening les boxes and it's ok

Wfhistoryerror2If this error persists, you can download, full history in a csv file that you can analize, yes you need to rean JSON code and Sharepoint http requests

in your flow error message copy le run ID to seek it in your csv file in url

https://make.powerautomate.com/environments/Default-d035406542/solutions/b03b5e55-c8d9-ed11-a7c7-000d3a2726a5/flows/21fb6dc1-0412-3540684-f0a6881c120f/runs/08585210145218379217946437495CU195Csvflow

Power Automate add line to Excel

By On 29/03/2023

Copy an Excel file from a template with an Sharepoint Http request

Createfolder 1

 


/_api/web/getFileByServerRelativeUrl('/sites/test@{variables('TemplateFileName')}')/copyTo(strNewUrl='/sites/test@{variables('ExportFolder')}/@{variables('ExportFileName')}',bOverWrite=true)

 

Header

 


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

Create An Excel Table

Excel createtable

Add your Datas in an Excel line

Excel addlineLine : 

 


@{items('Appliquer_à_chacun_2')}

 

 

 

 

 

PowerAutomate Add Folder

By On 10/02/2023

Powerautomate get folder by url 


/_api/web/GetFolderByServerRelativeUrl('@{variables('WebserverRelativeUrl')}/@{variables('DoclibUrl')}/Fiche_@{variables('FicheId')}')
GetfolderVerify status (exists = 200, does not exists = 404)

@{outputs('HttpGetFolder')['statusCode']}

Create folder


/_api/web/folders/add('@{variables('DoclibUrl')}/Fiche_@{variables('FicheId')}')

Createfolder

PowerAutomate Try Catch

By On 06/12/2022

Try catch in power automate

Try

 


2 jsonerror

 

    
        {
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "startTime": {
                "type": "string"
            },
            "endTime": {
                "type": "string"
            },
            "trackingId": {
                "type": "string"
            },
            "clientTrackingId": {
                "type": "string"
            },
            "clientKeywords": {
                "type": "array",
                "items": {
                    "type": "string"
                }
            },
            "code": {
                "type": "string"
            },
            "status": {
                "type": "string"
            },
            "error": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    }
                }
            }
        },
        "required": [
            "name",
            "startTime",
            "endTime",
            "trackingId",
            "clientTrackingId",
            "clientKeywords",
            "code",
            "status",
            "error"
        ]
    }
}
    

 

3 analysejson

 

    
        {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                },
                "location": {
                    "type": "string"
                },
                "tags": {
                    "type": "object",
                    "properties": {
                        "flowDisplayName": {
                            "type": "string"
                        },
                        "environmentName": {
                            "type": "string"
                        },
                        "logicAppName": {
                            "type": "string"
                        },
                        "environmentWorkflowId": {
                            "type": "string"
                        },
                        "xrmWorkflowId": {
                            "type": "string"
                        },
                        "environmentFlowSuspensionReason": {
                            "type": "string"
                        },
                        "sharingType": {
                            "type": "string"
                        }
                    }
                },
                "run": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "string"
                        },
                        "name": {
                            "type": "string"
                        },
                        "type": {
                            "type": "string"
                        }
                    }
                }
            }
        }

    
        concat('https://emea.flow.microsoft.com/manage/environments/', body('Analyser_JSON')?['tags']?['environmentName'], '/flows/', body('Analyser_JSON')?['name'], '/runs/', body('Analyser_JSON')?['run']?['name'])           
    

 

4 linkhisto


 

    
        a href="@{outputs('LinkToWfHisto')}​​​​​">​​​​​@{workflow()?['tags']?['flowDisplayName']} a
    

 


 

5 aref

PowerAutomate Date Format

By On 30/09/2022

formatDateTime('2009-06-15T13:45:30', 'M/dd/yyyy h:mm tt')  6/15/2009 1:45 PM

formatDateTime('2009-06-15T13:45:30', 'dd/MM/yyyy') 15/06/2009

formatDateTime('2009-06-15T13:45:30', 'd/M/yyyy') 15/6/2009

formatDateTime('2009-12-15T13:45:30', 'dddd/MMMM/yyyy') Tuesday/December/2009

formatDateTime('2009-12-15T13:45:30', 'ddd/MMM/yyyy') Tue/Dec/2009

PowerAutomate Functions

By On 21/04/2022

Concat

concat(outputs('Compose'),'test')

 

Get user mail in REST results

items('Appliquer_à_chacun')?['MyUser']?['EMail']

 

Add 10 Days

addDays(utcNow(),10)

 

Get JSON data

 

body('parameterJSON')?['Relaunch1nbDays']
body('myGet')?['value']

 

 

Get variable value

variables('RelaunchDate1')

 

Check data is empty

if(empty(variables('userMail')), null, variables('userMail'))

 

Date formatting

formatDateTime(your-value, 'dd/MM/yyyy hh:mm tt')

image base64 to <img>

 


Get_file_content_using_path_2')['$content']  //the $ is important
<img class="logo" src="data:image/jpeg;base64, @{body('Get_file_content_using_path_2')['$content']}" alt="My Image" />

 

Power Automate Check User Exists

By On 24/01/2022

Checkuser1

Checkuser2

 


/_api/web/ensureuser
content-type application/json; odata=verbose

{'logonName': '@{variables('userMailToCheck')}'}
@{outputs('Send_an_HTTP_request_to_SharePoint')['statusCode']}


PowerAutomate Add User To Group

By On 19/09/2021

Powerautomate add user to sharepoint group

Ajouter un utilisateur dans un groupe sharepoint en REST avec powerautomate

{"__metadata":{"type":"SP.User"},"LoginName":"i:0#.f|membership|@{variables('emailToAdd')}"}
{
  "siteUrl": "https://vvvvvvvvvvvvvvv.com",
  "Accept": "Accept",
  "ApplicationJson": "application/json; odata=verbose",
  "ContentType": "content-type"
}

 

Getassociatedmembers

 

Addusertogroup

 

PowerApps Build String To Link

By On 31/05/2021

Powerapps build your string to creae an html link

 


<div style="background-color:#000000;width:100%;"><code><a href="https://mySP.sharepoint.com/sites/DfSite/Lists/Initiatives/DispForm.aspx?ID=&quot;; InitiativeId; &quot;" style="color:#FFFFFF;height:100px">&quot;;SelectedInitiative.Titre;&quot;</a></code></div>
 

 

Buildlink

Powerautomate Caml Query

By On 27/05/2021

Powerautomate Caml Query

Camlquery

Powerautomate Add Comment To ListItem

By On 27/05/2021

Add comment to ListItem with powerautomate (http Sharepoint request)

Addcommentonitem

PowerAutomate Update ListItem HTTP REST

By 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": "*"
}


 

 

Power Automate Sharepoint Actions List

By On 31/03/2021

Power Automate Sharepoint Actions List

PoactionsPoactions2

Powerautomate Extract Data From Json Array

By 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

By 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

 

Power Automate Flow Functions

By On 18/06/2020

Power plateform

Power automate flow

 

Functions

Check date is null

if(equals(triggerBody()?['myDate'], null),'[myDate is null]', formatDateTime(triggerBody()?['myDate'], 'dd/MM/yyyy'))

Power apps

Display view on query string value

If ( !IsBlank(Param("taskDisplay")) && Param("taskDisplay")="true"; Navigate(DevTasksView;ScreenTransition.Cover) )

set variable value (separator in english is , in french ;)

Set(CurrentToShow; "loppement") ;; Set(CurrentButton; "DEV")