pnp / PnP-Provisioning-Schema

Office 365 Patterns and Practices - Remote Provisioning Schema
MIT License
161 stars 220 forks source link

Is there a way to keep itemid using DataRows to import data for lookup fields / lists #619

Open magonzalezm opened 1 year ago

magonzalezm commented 1 year ago

I have use Get-PnPSiteTemplate to get the schema of a site.

Then I've used Add-PnPDataRowsToSiteTemplate for two lists, let's called them Property and PropertyType.

When exported, I have for propertytype:

House 100 20_.000 Apartment 200 22_.000 For property to simplify: House1 100 10 Highstreet 1 20_.000 When I use Apply-PnPProvisioningTemplate, all the ids of Propertytype have changed, so every Property has the wrong Propertytype. Could you help me exporting this so that when imported the ids are the same?
miszuni commented 1 year ago

I have the same problem. Unfortunately, it is not trivial. I tried copying the contents of the list via power automate. The problem is the same i.e. lookup indicates an ID that is automatically generated and this attribute is read only - consequently it cannot be changed. Please take a peek here: https://sharepoint.stackexchange.com/questions/288052/is-it-possible-to-update-default-id-column-of-a-list-in-sharepoint-online Currently I have not solved this problem.

magonzalezm commented 1 year ago

Yes, I know that the ID cannot be set from pnp normal scripts but I expected that the provisioning template would do it, or should do it. Compare this to the Sharepoint Migration Tool, the SMT respects the IDs we are migrating. I suppose they have conceived the provisioning template as a tool to display structures, but not data, because if it was so, they should have respected the IDs, for these cases.