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

1 Like

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.
2 Likes

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

1 Like

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!

1 Like

I have run into similar issue. Any update on the resolution. I am using 2021.10.5 community edition. “Upload Blob from File: An error has occurred. Please check the logs Error: Type provided must be an Enum.
Parameter name: enumType”

Nope, could not find a solution for this error

1 Like

@Ritvik_Bajaj Interestingly the upload does work. I see file was uploaded even though the exception is thrown. As a work around I am catching and ignoring the exception using Try catch. Getting the uploaded blob info back in Finally section using Get Blob activity. Give it a try. Good Luck! Run in non debug mode. I am taking the liberty as I am doing for POC :slight_smile:

1 Like

Yes the upload works, but for me the use case changed therefore I did not follow this approach :sweat_smile:

I just want to say I am also getting same error.

Hello everyone, the same error came up during my development, I managed to identify that it is the because of the tier with which I was updating my files. I leave you a reference image:

2 Likes

I just wan to say some heroes don’t use cape and @Angel_Jac is the proof

Thanks for the solution!
this works for me as well.