■現在行っていること
Uipathを使用して、Excel等のファイルの名前を変数に入れて、それをMicrosoftのサービスのTeamsにAPIを使用して投稿しています。
そこでPower Shellを使用して投稿しているのですが、Uipathでファイル名が入った変数をInvokePowerShellで使用することはできますか?
First of all my kind request is that post queries in English so you will get a wider range of audience, and they will respond.
Coming to the point, Yes you can pass variable from UiPath to powershell.
Create argument with same name as your variable in Powershell script and pass value.
If my answer is inappropriate kindly excuse, as i have translated your query hence it my mean something else.
Reply with actual query in English please.
thank you for reply !!!
"$URI = ‘https://●●●●●●●●●●●●●●●●●●’
$body = ConvertTo-JSON @{
text =Uipath Variable ← 【i want to use Uipath Variable here 】
}
$body = [Text.Encoding]::UTF8.GetBytes($body)
Invoke-RestMethod -uri $URI -Method Post -body $body -ContentType ‘application/json’"
create a varible like this
$input in Powershell script
Then as mentioned above in uipath under Invoke power shell, in PowerShellVariables create argument with name input and in value add data that you need to pass to powershell.
like this?
"$URI = ‘https://●●●●●●●●●●●●●●●●●●’
$body = ConvertTo-JSON @{
text =Uipath Variable ← 【i want to use Uipath Variable here 】
}
$body = [Text.Encoding]::UTF8.GetBytes($body)
Invoke-RestMethod -uri $URI -Method Post -body $body -ContentType ‘application/json’"
$input = example
"$URI = ‘[https://●●●●●●●●●●●●●●●●●●](https://xn--51haaaaaaaaaaaaaaaaa/)’
$input
$body = ConvertTo-JSON @{
text = $input
}
$body = [Text.Encoding]::UTF8.GetBytes($body)
Invoke-RestMethod -uri $URI -Method Post -body $body -ContentType ‘application/json’"
what is this?
(https://●●●●●●●●●●●●●●●●●●/)
and
in powershellVariable. i cant understand that why Value is "Sample text "??
For example i have given as Sample text, instead of Sample text pass string which you need to pass.
For example:
If you need to pass ‘https://www.google.com’
Instead of Smaple text pass “https://www.google.com”
”Sample text ” is my original name?
"$URI = ‘●●●●●●●●●●●●’
$input
$body = ConvertTo-JSON @{
text =$input
}
$body = [Text.Encoding]::UTF8.GetBytes($body)
Invoke-RestMethod -uri $URI -Method Post -body $body -ContentType ‘application/json’"
No its a sample data i put in screenshot to make you understand, in that place put the string you need to pass.
OK
but error
Invoke Power Shell: The term ‘japan’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
"$URI = ‘●●●●●●●●●●●●●●’
$input=japan
$body = ConvertTo-JSON @{
text =input
}
$body = [Text.Encoding]::UTF8.GetBytes($body)
Invoke-RestMethod -uri $URI -Method Post -body $body -ContentType ‘application/json’"
No,
"$URI = ‘●●●●●●●●●●●●●●’
$input
$body = ConvertTo-JSON @{
text =input
}
$body = [Text.Encoding]::UTF8.GetBytes($body)
Invoke-RestMethod -uri $URI -Method Post -body $body -ContentType ‘application/json’"
In UiPath use input instead of japan.
i have changed but error
In invoke powershell activity did you check Is script
Some error with your powershell script.
this is no issue
"$URI = ‘●●●●●●●●●●●●●●●●●●●●’
$body = ConvertTo-JSON @{
text =‘input’
}
$body = [Text.Encoding]::UTF8.GetBytes($body)
Invoke-RestMethod -uri $URI -Method Post -body $body -ContentType ‘application/json’"
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.