Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
836 views
in Technique[技术] by (71.8m points)

sharepoint - Add-PnPDataRowsToProvisioningTemplate with empty -fields parameter not working?

I want to use a modern SPO team site als a template for similar projects with a prefilled task list (very similar projects).

I created a site template with Save-PnPProvisioningTemplate and tried to add the Data rows with Add-PnPDataRowsToProvisioningTemplate and a empty -fields parameter but that does not work. I need exact the same task list as in the template.

Does anybody know if this is a bug?

I already discussed on this particular topic right here: https://docs.microsoft.com/en-us/answers/questions/211447/copy-spo-team-site-with-task-list-contensrow-data.html?childToView=215328#answer-215328 but wanted to check here before I post a bug on github.

Thanks

Chris


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

According to the documentation of Add-PnPDataRowsToProvisioningTemplate for the parameter fields:

The fields to retrieve. If not specified all fields will be loaded in the returned list object.

So, if you leave the -fields parameter empty, it will load all fields including default system fields like Created, Created By, Modified... These default fields are generated by SharePoint and could not be added/edit manually. I think that's the reason that would not work.

So you need to specify the fields parameter which can be edited by end users. Like column duedate, Title, startdate in the command.

Note: you need to use the internal name of the column, for the description column in the task list. The internal name is Body.

You could change field in the template <FieldRef Name="Description" /> to <FieldRef Name="Body" />. Maybe it would work fo you enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...