-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to add list items in a simple site.. but keep getting Invalid file name error: #312
Comments
@bhishma: how do you connect, e.g. which way of connecting with Connect-PnPOnline do you use? |
@bhishma: please also share the output from |
@erwinvanhunen, I'm using StoredCredentials to connect Connect-PnPOnline -Url "" -Credential "myaccount" @jansenbe , When I execute Get-PnPException, it does not return anything.
|
Trying to eliminate causes, are the items actually being created? Or you just receive the file not found message? Have you tried without the -Details parameter? |
They are not created. I tried without -Details as well. Same result. |
The detail lines you see contain more information: $details = Invoke-PnPBatch -Details
$details | select ResponseJson We're interested in seeing the full detail of the ResponseJson. Another thing: could you try to run the If neither of these steps above return any data: |
I can see this in Details but Nothing in ResponseJson.
If I use StopOnExecution this is the error:
I'm behind corporate proxy, I'm not able to connect to SPO if I let Fiddler change proxy. If I use corporate proxy, Fiddler is not capturing the traffic. I'll try to do this on a computer that's not on proxy. |
okay, the results you see are actualy error reports from the server. And when looking at the URL for each request I see something strange there. The guid of the list is written as I'm moving this issue to the Core SDK and we continue in that repo with this issue. |
Sorry for confusion. I meant to not show the real guid here that's why tried to obfuscate. |
Okay, that explains :-) In our ongoing investigation, could you run the exact following snippet in a test site? New-PnPList -Title "PnPTestList" -Template GenericList
$list = Get-PnPList -Identity "PnPTestList"
$batch = New-PnPBatch
1..5 | %{ Add-PnPListItem -List $list -Values @{"Title"="Title $_"} -Batch $batch }
Invoke-PnPBatch $batch -StopOnException And see what happens? Just to determine if there is something with the list that makes it throw the exception. |
I still get same issue:
|
I'm almost starting to wonder if the corporate proxy you mentioned is doing something in between. The main difference between using batching and non-batching is how we make the API calls behind the scenes. When adding an item without batching we use CSOM, when adding a item through batching we use the SharePoint REST api. Can you try to open this in your browser (where you obviously replace the url with actual tenant name and the id of the list)? You should receive an XML response.
Notice that the id component should be formatted as |
@bhishma : do you have an update to share? |
I think Erwin is correct. Must be the proxy thing. I was able to execute same command outside of proxy. However I do get the XML response when I try to hit the endpoint with proxy too. |
We would propose to exclude the SharePoint tenant from the proxy, but it unfortunately stops here for us as we cannot control your proxy. |
I'm having the same problem, but I'm not sitting behind a proxy. I tried it with two different tenants, but it's failing for both. |
I am having the same issue, and I a not behind a proxy either. |
@ollimenzel and @rtonerii : Are you both using the PnP.PowerShell? What version? I can confirm that this works fine in PnP.Core via C#. |
Hi in the meantime I opened a new report, and it was also reproduceable as you can see here: |
@ollimenzel : That root Site Collection was definitely the piece I was missing. I don't know if that's the same issue for @rtonerii or not. I've submitted a PR and will see if it's accepted by @jansenbe . |
Thanks for helping out! |
@DaleyKD : thanks for helping out and creating the PR |
I have been testing this on a sub-site collection. I installed the latest from today and I am having other issues.
|
@rtonerii : Could you show me your full |
@DaleyKD Here is the script.
I did some more testing and it works in a PowerShell console window but it errors in the VS Code development environment. |
Can you check the PS version where it works (and not works). You get the PS version via |
Name Value PSVersion | 5.1.19041.906 |
so is the working version (PS console) or the non working version (VS Code)? I want to understand if there's a difference between those. PS version 5 uses .NET Framework while PS version 7+ uses .NET Core / .NET 5 |
I can try both on monday. |
OK, Only on the root site. |
OK, some more updates. I am now able to successfully process the above script on both the root site and a sub-site collection with PS 7.1. I am getting the following error on PS 5.1, in VS Code. Everything works with the regular PowerShell console windows. |
It seems as in the 5.1 console version of VS Code some other module is loaded first loading an older version of an assembly (possibly System.Text.Encodings.Web.dll)...when the PS module is loaded afterwards things fail. You could consider switching to PS7 in VS Code (https://rnelson0.com/2020/03/05/using-powershell-7-in-vs-code/). In general there's no easy fix for this as in PS world modules can easily load conflicting assemblies...best is to not load too many modules by default and then load the modules you need on demand. |
Thanks, |
I'm trying to add list items in a simple site.. but keep getting Invalid file name error:
results in
Invalid file name.
The file name you specified could not be used. It may be the name of an existing file or directory, or you may not have permission to access the file.
I'm using
Manifest 1.2.0 PnP.PowerShell
Tested with nightly build as well:
Manifest 1.2.7 PnP.PowerShell
Note: it works if I remove the batching.
Originally posted by @bhishma in pnp/powershell#195
The text was updated successfully, but these errors were encountered: