question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding multiple ListItem problem

See original GitHub issue

Category

  • Bug

Describe the bug

I have a foreach cycle to define and upload multiple ListItem in a SharePoint List. The items are created inside some subfolders. (but I also tried in the root of the library) The first Item is correctly created, all the next items are not created and no error or exception is rised.

Steps to reproduce

IList list = await ctx.Web.Lists.GetByIdAsync(new Guid(config.Value.ListIdSessioniFormative));

foreach (var session in edition.sessions)
{
          Dictionary<string, object> data = new Dictionary<string, object>()
          {
              { "Title", edition.editionCode },
              // various metadata
          };
          IListItem item = list.Items.Add(data, $"{folderCompany}/{folderYear}");
}

Expected behavior

A number of item equal to the foreach round should be created.

Environment details (development & target environment)

  • SDK version: [1.2.0 ]
  • OS: [Windows 10]
  • SDK used in: [ASP.Net Web app]
  • Framework: [.NET Core v3.1 ]
  • Browser(s): [Chrome v90]
  • Tooling: [Visual Studio 2019]
  • Additional details:

Additional context

DELETE THIS LINE BEFORE SUBMITTING - Provide any other context about the problem.

Thanks for your contribution! Sharing is caring.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
jansenbecommented, Jul 2, 2021

@Micael-stack : with tomorrow’s PnP PS build you should see an exception being thrown for this (as PnP PS was still using an old PnP Core library). Good that you’ve found the failing field…maybe create a PR for the PowerShell docs to clarify this?

1reaction
Micael-stackcommented, Jun 25, 2021

@jansenbe If your static and internal dont match, it is because you got into two possibilities : the internal name was already used within the site, or, the length was too long. Static name is not unique and internal should always be prefered if we want perfect match…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Multiple ListItem elements defined on page
We are using itemListElement. This page includes details of 65 boarding schools, but the issue is that whenever I am trying to add...
Read more >
Adding ListItems causes an error "Cannot have multiple ...
I am getting an error message "Cannot have multiple items selected in a DropDownList." After searching SO and google, I have narrowed the...
Read more >
Unable to make more than one list item per list
Unable to make more than one list item per list · 1. insert list block as usual · 2. write “First” at the...
Read more >
Unable to make more than one list item per list - page 2
When creating a list we cannot create more than one list item at each level. ... One question, do I keep 'core/list' and...
Read more >
List not working! When adding item it saves then creates ...
List not working ! When adding item it saves then creates multiple duplicates of same item. Hi Everyone! We have an issue with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found