Powershell could not import module

Powershell action in Easymorph cannot import module PnP.PowerShell.
when I try to import module with
Import-Module PnP.PowerShell
command, it throws following error message. Module has been installed from powershell and updated to latest version.

Could not load type ‘Microsoft.SharePoint.Client.SearchBoxInNavBarType’ from assembly ‘Microsoft.SharePoint.Client, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’.

Has anybody experienced problems like this?

Hi Amgalan,

The error doesn’t seem to relate to EasyMorph. Does the PowerShell script work when executed not in EasyMorph but in the PowerShell terminal under the same user account?

yes it does.
And I found this thread
https://techcommunity.microsoft.com/t5/office-365/can-t-import-sharepoint-online-powershell-module/m-p/359581
Not sure if easymorph can resolve this issue though.

The reason I am using the module was to download list of files from sharepoint. I could have used sharepoint list action in my project but the site is dynamic which I retrieved from a file. If there is a site which does not have a connection, I am in trouble. Instead using sharepoint static connections, I am using powershell to connect to sharepoint sites and download files to perform etl stuff.
If there is an alternative way to perform this kind of tasks in easymorph, please suggest.

Thanks

How many SharePoint sites do you need to retrieve files from?

between 10-20 sites.

If you know the sites in advance, I would suggest creating 10-20 connectors to respective sites. In the “SharePoint command” action, the connector name can be specified using a parameter. Therefore, based on the file name you can calculate the necessary connector name to use. Then use the “Iterate” action to assign a column value to a parameter of the called module. In the called module, use the “SharePoint command” action with the parameter-specified connector.

Thanks @dgudkov for the suggestion. I will try that.