Sharepoint question

I have some easyMoprh tasks that use powershell to get data from Sharepoint.
easyMorph version : 4.1.0.12

Import-Module SharePointPnPPowerShellOnline -WarningAction SilentlyContinue 
$Username = "{Username}" 
$Password = "{Password}" 
$DocLib = "{DocLib}"
$RelativePath = "{RelativePath}"
$SiteCollection = "{SiteCollection}" 
 
[SecureString]$SecurePass = ConvertTo-SecureString $Password -AsPlainText -Force 
[System.Management.Automation.PSCredential]$PSCredentials = New-Object System.Management.Automation.PSCredential($Username, $SecurePass) 
 
try { 
    Connect-PnPOnline -Url $SiteCollection -Credentials $PSCredentials 
    if (-not (Get-PnPContext)) { 
        Write-Output("Error connecting to SharePoint Online, unable to establish context");
        return 
    } 
} catch { 
    Write-Output("Error connecting to SharePoint Online: " + $_.Exception.Message);
    return 
} 

$Files = Get-PnPListItem -List $DocLib -Query "<View><Query><Where>
<Or>
    <And>
        <Eq>
            <FieldRef Name='File_Returned'/><Value Type='Text'>1</Value>
        </Eq>
        <Eq>
            <FieldRef Name='File_ReturnProcessed'/><Value Type='Text'>0</Value>
        </Eq>
    </And>
    <Or>
        <Eq>
            <FieldRef Name='File_Ready'/><Value Type='Text'>0</Value>
        </Eq>
        <And>
            <Eq>
                <FieldRef Name='StatusUpdateRequested'/><Value Type='Text'>1</Value>
            </Eq>
            <Eq>
                <FieldRef Name='StatusUpdateProcessed'/><Value Type='Text'>0</Value>
            </Eq>
        </And>
    </Or>
</Or>
</Where></Query></View>"


if ($Files.Count -gt 0) {
    foreach($File in $Files) {        
		...
	}
}

Can this be transferred to using easyMorph command action?
When i try to debug the code from easyMorph is is showing following error Error connecting to SharePoint Online: The ‘Connect-PnPOnline’ command was found in the module ‘SharePointPnPPowerShellOnline’, but the module could not be loaded. For more information, run ‘Import-Module SharePointPnPPowerShellOnline’.
When I run the same powershell script in Powershell ISO it works fine.

Please advise.

Thanks.

Hi Bolud,

you can import SharePoint lists in EasyMorph using the “Import SharePoint list” action, without PowerShell. Did you try it? The list name seems to be specified in the $DocLib variable in your script.

Hi Dmitry,

I tried to use “Import SharePoint list” but the $DocLib is not listed in SourceList. I am novice when it comes to Sharepoint and the way I understood is that $DocLib is Sharepoint form for file with lots of custom status fields that is accesible via https://XXXXX.sharepoint.com/sites/######/{DocLib}/Forms/AllItems.aspx

Hi Bolud,

“Import SharePoint list” action doesn’t show document libraries in the drop-down list.
You should specify the name of your document library through a parameter:

image

I tried to use list as parameter but still no success.

Error: List 'DocListXXX' does not exist at site with URL 'https://xxxxxx.sharepoint.com/sites/#####'.
Source: action "Import SharePoint list" in , table "Imported table 1"

I am thinking that it is because $DocLib is not list it is a Form.

Why do you think that it’s a form?

The URL looks like an URL to a document library page. It seems that the “Forms” part in the URL just designates pages that modify the corresponding document library.

In any case, if the Get-PnPListItem cmdlet from your PowerShell can find that list or form, EasyMorph should be able to find it too.

Are you sure that you correctly specified SharePoint site in your SharePoint connector in EasyMorph?

Is it possible for you to send the actual URL for that document library and a screenshot of your connector settings to our support email?

I am not sure why I think that. I have no experience in Sharepoint. I guess the guy who created it is using a Powershel for a reason. Maybe I am doing something wrong. I will double check. meanwhile could you put here sample em project file that loads a SP list with filter. I would like to compare it.

The DocLib is not listed in sharepoint site as list either.

Thanks for your help.

The "Import SharePoint list" action can't filter items on its own. You should either load all the items and then filter them in EasyMorph or create a new view in SharePoint with required filters and then import that view with EasyMorph.

I will look into the issue with PowerShell script, but it will take me some time.

Can you please check that it's not listed on the site's content page as any other type:

As for your screenshots: can you please make a screenshot of connector settings, not the "Import SharePoint list" action settings. Is it possible for you to send a screenshot of the connector settings without blacked-out parts and a full actual URL of your library to our support email?

The Doclib is listed as Document library in sharepoint. But now I started to have another issue with connector.


Our password has updated last friday for sharpoint connector user and the password contains “<” could “<” letter in password be a reason fro this error?

The “<” character should not be a problem. It’s possible that the authentication workflow on your SharePoint server was changed.

How do you usually login to that SharePoint Online site? Do you use Windows authentication? Do you use two-factor authorization?

Service account password was updated with “<” in it. It used to work fine maybe our “IT” dept changed some policy. Thanks.
How would I import Sharepoint document library from easyMorph?

If the Doclib is listed as a Document library then you should be able to import it by specifying its name with a parameter. I just tested it and it worked correctly.

It’s possible that the connector is not configured correctly. But I can’t check it without seeing the actual URL and connector settings.

Can you upload your sample project please. Connection issue is resolved. Now I can connect to sharepoint from easymorph.

Here is a sample project. You’ll have to add\choose your connector.

ImportDocumentLibraryAsList.morph (2.4 KB)