Why is a UiPath Studio with UiPath.MicrosoftOffice365.Activities version lower than 2.4.3, after compiling the project, the Upload Files activity fails with error "'LocalResource' is not declared. It may be inaccessible due to its protection level."
Issue Description
When compiling a Project in UiPath Studio with Activity Package - "UiPath.MicrosoftOffice365.Activities" version lower than 2.4.3, the Upload Files activity fails with below error:
Unexpected error has occurred during the library compilation process: The assembly compilation returned the following errors: * 'LocalResource' is not declared. It may be inaccessible due to its protection level. * 'LocalResource' is not declared. It may be inaccessible due to its protection level.
Example:
Root Cause:
The issue is caused when the version of UiPath.MicrosoftOffice365.Activities package in UiPath Studio is older than 2.4.3.
Resolution:
- Upgrade UiPath.MicrosoftOffice365.Activities activity package to version 2.4.3 or higher
- After upgrading the "UiPath.MicrosoftOffice365.Activities" to 2.4.3 or higher, follow the below steps to upload files to the SharePoint Site on a Document Library .
- FilePath variable of type System.String and value "FULL_LOCAL_FILE_PATH_LOCATION"
- SharePointFile variable of type UiPath.Platform.ResourceHandling.ILocalResource with value LocalResource.FromPath(FilePath)
- In the Upload Files, use the SharePointFile variable in the Collection.
Example:
Sample results: