Skip to content
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

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

Open
magonzalezm opened this issue Jun 1, 2023 · 2 comments
Labels
type:enhancement New feature or enhancement of existing capability type:question

Comments

@magonzalezm
Copy link

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:
<pnp:DataRows UpdateBehavior="Overwrite">
pnp:DataRow
<pnp:DataValue FieldName="Title">House</pnp:DataValue>
<pnp:DataValue FieldName="Order">100</pnp:DataValue>
<pnp:DataValue FieldName="MetaInfo" />
<pnp:DataValue FieldName="FileLeafRef">20_.000</pnp:DataValue>
</pnp:DataRow>
pnp:DataRow
<pnp:DataValue FieldName="Title">Apartment</pnp:DataValue>
<pnp:DataValue FieldName="Order">200</pnp:DataValue>
<pnp:DataValue FieldName="MetaInfo" />
<pnp:DataValue FieldName="FileLeafRef">22_.000</pnp:DataValue>
</pnp:DataRow>
</pnp:DataRows>

For property to simplify:
pnp:DataRow
<pnp:DataValue FieldName="Title">House1</pnp:DataValue>
<pnp:DataValue FieldName="Order">100</pnp:DataValue>
<pnp:DataValue FieldName="MetaInfo" />
<pnp:DataValue FieldName="Address1">10 Highstreet</pnp:DataValue>
<pnp:DataValue FieldName="PropertyType">1</pnp:DataValue>
<pnp:DataValue FieldName="FileLeafRef">20_.000</pnp:DataValue>
</pnp:DataRow>

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?

@magonzalezm magonzalezm changed the title Is there a way to keep itemid using DataRows to import data Is there a way to keep itemid using DataRows to import data for lookup fields / lists Jun 1, 2023
@miszuni
Copy link

miszuni commented Jun 7, 2023

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
Copy link
Author

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.

@PaoloPia PaoloPia added type:enhancement New feature or enhancement of existing capability type:question labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or enhancement of existing capability type:question
Projects
None yet
Development

No branches or pull requests

3 participants