Getting an error while using Microsoft 365 in my code "Compilation failed or was Cancelled"

Hi,

I’m trying to use Microsoft office 365 in my code to send email. I’m using config file to get the data as an config variable. there was no errors and when I debug or run the program I’m getting the above mentioned error during compilation. when I searched about this in forum, I could see that its an version problem.

Could anyone help me out with this? should I change my version or any other possible solution is there to solve it.
My current version is 2022.4.7

I’m pasting the complete error here for the reference.

"Unexpected error has occurred during the library compilation process:
The assembly compilation returned the following errors:

  • Namespace or type specified in the Imports ‘System.Activities.DynamicUpdate’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases.
  • Namespace or type specified in the Imports ‘GlobalVariablesNamespace’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases.
  • Namespace or type specified in the Imports ‘GlobalConstantsNamespace’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases.
  • ‘Directory’ is ambiguous, imported from the namespaces or types ‘System.IO, Microsoft.Graph’.
  • ‘Directory’ is ambiguous, imported from the namespaces or types ‘System.IO, Microsoft.Graph’.
  • ‘Directory’ is ambiguous, imported from the namespaces or types ‘System.IO, Microsoft.Graph’.
  • ‘Directory’ is ambiguous, imported from the namespaces or types ‘System.IO, Microsoft.Graph’."

Hi @Rashmika_Barathan ,

For the Errors highlighted, we maybe able to solve it by providing the full namespace like below :

System.IO.Directory

You would need to use the above wherever you have used just Directory.

Example :

Directory.GetFiles("FilePath")

to

System.IO.Directory.GetFiles("FilePath")

This is because of the use of Microsoft Office 365 Activities/Package, as it also contains a method called Directory in it, UiPath/.Net compiler would not be able to interpret from which namespace it was called.

For the Other Error part, Could you maybe check after correcting the above if it is still present ?

Hi Arpan,

I tried these already, but getting the same error only. Is there any particular package to be installed for this? Any idea on that?