pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

Invoke-PnPSiteTemplate - Import Directory failed on MacOS

Open salascz opened this issue 11 months ago • 1 comments

Hello, there seems to be an issue with importing the whole directory on non Windows system.

I am using following declaration in my template.xml file:

<pnp:Files>
  <pnp:Directory Src="files" Folder="SiteAssets/Data" Overwrite="true" Level="Published" />
</pnp:Files>

The operation failed with error: An error occurred: Value cannot be null. (Parameter 'clientObject')

Trace Log:

[PnP.Framework]	[0]	[Error]	ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerException: The file or folder name "SiteAssets/Data/files\test-file.html" contains invalid characters. Please use a different name. Common invalid characters include the following: # % * : < > ? /  |
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb)
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync()
   at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync()
   at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync()
   at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent)

Please note, there seems to be backslash symbol used in file path...

Expected behavior

I should be able to import the directory from MacOS similar to Windows

What is the version of the Cmdlet module you are running?

PnP.PowerShell version 2.3.0

salascz avatar Mar 07 '24 09:03 salascz

Facing the same issue. PnP.PowerShell version 2.4.0

maxali avatar May 14 '24 22:05 maxali