Apr 29 2019 08:29 AM
The documentation says that running site scripts is nondestructive in that if a list already exists the script will skip creating a new one and update the existing list and I could have sworn it was doing that not long ago but in my testing now I am getting a brand new list every time I run my script. It is just appending a number to the end of the internal name and creating a new list. Did something change or is there something I'm doing wrong to cause that?
Apr 29 2019 08:45 AM
Apr 29 2019 09:53 AM
@Rob EllisNo, I'm working on adding columns and views so as I add them I rerun this script to update the script stored in the tenant. Maybe it makes a difference if I delete the site design and re-add it rather than just updating the script?
Apr 30 2019 12:16 AM
Apr 30 2019 06:29 AM - edited Apr 30 2019 06:30 AM
@Rob EllisI figured out what is going on. I am using the site script to create a new list but I was trying to be a good "old school" SharePoint developer and create the list name without any spaces. So when I was using the "CreateSPList" verb I was using something like "ListName" as the value for listName in the script command and then I was setting the title to "List Name" with a space in it as a subaction.
But if you do that and re-run the script it tries to find a list with a display name of "ListName" and there isn't one. So it creates a new list called "ListName" and a display name of "List Name". Because there is already a list called "ListName" it adds a number to the end of it and recreates it.
Does that make sense? Bottom line, I need to be okay creating lists and libraries with spaces in the internal name (my inner SharePoint developer self is cringing at that comment).
Apr 30 2019 09:16 AM