Unable to figure out where the Enum parameter is the be given in the For each file in folder Activity

Hi Everyone,
Greetings for the day,
I am new to the community and to UiPath as well. Guys I am trying to make a bot using UiPath which uploads files present in a folder to Azure Blob storage account.I’m defining the activity in the Azure Scope and there is no issue in retrieving the Azure subscriptions details for the activity. Then in it I am using “For each File in Folder” activity to upload all the files present in the folder (the activity is as follows)

Everything is working fine till the last step of the activity i.e the upload Blob from File. All the properties for the upload blob from file have been mentioned like in the screenshot below


But I am getting this Error: RemoteException wrapping UiPath.Azure.Core.AzureException: An error has occurred. Please check the logs Error: Type provided must be an Enum.
Parameter name: enumType —> RemoteException wrapping System.ArgumentException: Type provided must be an Enum.
Parameter name: enumType
at System.Enum.TryParseEnum(Type enumType,
String value,
Boolean ignoreCase,
EnumResult& parseResult)
at System.Enum.Parse(Type enumType,
String value,
Boolean ignoreCase)
at System.Enum.Parse(Type enumType,
String value)
at UiPath.Azure.Services.AzureBlobService.d__8.MoveNext()
— End of inner exception stack trace —
at UiPath.Azure.Activities.AzureActivity`1.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)
image

and don’t know how to troubleshoot it. I am not sure where this Enum type is to be mentioned.
Kindly Guide me through it
Thanking in anticipation

Hey,
Below is described all properties of this activity.
To be honest I did something like this but in C# code because these activity wasn’t available :slight_smile:
It’s looks like you have to choose correctly type of your blob. Take a look also here:

The parameters of this activity are:

  • BlobContainer (BlobContainer) - The blob container.
  • BlobName (String) - The name of the blob.
  • Type (Enum) - The type of the blob.
  • UploadVHDFileAsPageBlob (Boolean) - Specify whether to upload .vhd files as page blob (recommended).
  • FileToUpload (String) - The full path to the file to be uploaded.
  • ContentType (String) - The content type.
  • Metadata (DataTable) - Metadata for the blob. It shall contain two columns, the first one representing the name and the second its value.
  • Timeout (seconds) - Specifies the amount of time (in seconds) to wait for the activity to run before an error is thrown. If not set, the activity runs until completion.

Hi @pikorpa, before starting working on the bot i went through all the documentations and stuff and cross checked them after encountering the error as well, the perimeters and the properties are defined properly, there must be something other than that but can you tell me what approach did you take for the code and did you get the azure credentials from the c# code too?
I’ll try to explore the invoke code activity too in order to make it work.
Thanks @pikorpa

If I’ll find some time during the weekend, I will create a blob in Azure and check these UiPath’s activities for Azure and I will come back to you with the answer.

Regarding c# solution:
Firstly I get the token:

const string ResourceId = “https://storage.azure.com/”;
const string AuthInstance = “https://login.microsoftonline.com/{0}/”;
string authority = string.Format(CultureInfo.InvariantCulture, AuthInstance, tenantId);
AuthenticationContext authContext = new AuthenticationContext(authority);
var clientCred = new ClientCredential(applicationId, clientSecret);
AuthenticationResult result = authContext.AcquireTokenAsync(
ResourceId,
clientCred
).Result;
accessToken = result.AccessToken;

and then I could upload the files:

String storageEndPoint = “core.windows.net”;
srcPathToUpload = String.Format(@srcPathToUpload);
uploadBlobPath = String.Format(@uploadBlobPath);
String blobDirectory;
TokenCredential tokenCredential = new TokenCredential(accessToken);
StorageCredentials storageCredentials = new StorageCredentials(tokenCredential);
CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(storageCredentials, storageAccountName, storageEndPoint, useHttps: true);
CloudBlobClient blobClient = cloudStorageAccount.CreateCloudBlobClient();
CloudBlobContainer blobContainer = blobClient.GetContainerReference(containerName);
CloudBlockBlob blob = blobContainer.GetBlockBlobReference(uploadBlobPath);
blob.UploadFromFile(srcPathToUpload);

Thank you @pikorpa, it would be a great help, in the meantime I’ll try using this method as well and get back to you if I face any issues.
Thanks a lot!