Hi,
Can anyone know how to invoke java,.Net,Node code in UiPath?
Hi @Riya_Sharma,
You can use Invoke code activity as shown below:
In the drop down, you can select language as VBnet or C#.
And for VBA, separate Invoke VBA and Invoke VBscript activities are there which you can use.
Regards
Sonali
Hi @Riya_Sharma
Please watch these videos to learn how to invoke codes in UiPath:
C#: UiPath | Invoke C# Code | How to invoke C# Code in UiPath | C Sharp | Coding in UiPath | Programming - YouTube
VBScript: UiPath | Invoke VBScript Simple | How to invoke vbscript in UiPath | Add two numbers | Programming - YouTube
VBScript with Arguments: UiPath | Invoke VBScript With Arguments | How to invoke VBScript in UiPath with Input Arguments - YouTube
Python: UiPath | Invoke Python Script | Invoke Python Code | How to invoke python code in UiPath | Python - YouTube
PowerShell: UiPath | Invoke Power Shell Code | How to invoke Power Shell Script in UiPath with Input Parameters - YouTube
Best regards
Mahmoud
Use Invoke Java Method activity to invoke Java code.
Hi @Riya_Sharma,
For that, install below package as shown:
You will then be able to drag and drop below activity to invoke java code:
Hope it helps.
Regards
Sonali
@sonaliaggarwal47
But how go invoke code under this invoke java method?
Hi @sonaliaggarwal47
Can you please help me to invoke the below code?
package com.box;
import com.box.sdk.BoxConfig;
import com.box.sdk.BoxDeveloperEditionAPIConnection;
import com.box.sdk.BoxFile;
import com.box.sdk.BoxFolder;
import com.box.sdk.BoxItem;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class Playground {
public static void main(String[] args) throws Exception {
Path configPath = Paths.get("config.json");
Path currentDir = Paths.get("").toAbsolutePath();
try (BufferedReader reader = Files.newBufferedReader(configPath, Charset.forName("UTF-8"))) {
BoxConfig boxConfig = BoxConfig.readFrom(reader);
BoxDeveloperEditionAPIConnection client = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig);
String folderId = "987654321";
BoxFolder folder = new BoxFolder(client, folderId);
String folderName = folder.getInfo().getName();
Path localFolderPath = currentDir.resolve(Paths.get(folderName));
if (!Files.exists(localFolderPath)) {
localFolderPath = Files.createDirectory(localFolderPath);
} else {
localFolderPath = resetLocalFolder(localFolderPath);
}
for (BoxItem.Info itemInfo: folder) {
if (itemInfo instanceof BoxFile.Info) {
BoxFile.Info fileInfo = (BoxFile.Info) itemInfo;
BoxFile file = new BoxFile(client, fileInfo.getID());
String localFilePath = localFolderPath.resolve(Paths.get(fileInfo.getName())).toAbsolutePath().toString();
FileOutputStream stream = new FileOutputStream(localFilePath);
file.download(stream);
stream.close();
}
}
}
}
static Path resetLocalFolder(Path localFolderPath) throws IOException {
Files.list(localFolderPath).forEach(file -> {
System.out.println(file.getFileName());
try {
Files.delete(file.toAbsolutePath());
} catch (IOException e) {}
});
Files.delete(localFolderPath);
localFolderPath = Files.createDirectory(localFolderPath);
return localFolderPath;
}
}