You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for field in site_columns:
print(f"📝 Creating field: {field.internal_name} on destination site")
try:
new_field = ctx_dest.web.fields.create_field_as_xml(field.schema_xml, field).execute_query()
except Exception as e:
print(f"An error occurred in field creation on target site: {e}")
`
new_field is created but it is not "comitted on the target site and does not show up on the target site column page.
Anything I'm doing wrong here? Is it even possible to create columns on the site level using create_field_as_xml ?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi there,
I'm trying to achieve to following: read all site columns, content types, ct to field mappings from one (DEV) sharepoint site to another (PROD) site.
But the first step to create the fields on the target site fails. The fields are not created on the target site.
`ctx = ClientContext(site_url).with_credentials(ClientCredential(client_id, client_secret))
ctx_dest = ClientContext(site_dest_url).with_credentials(ClientCredential(client_id, client_secret))
site_columns = ctx.web.fields.get().execute_query()
ctx.load(site_columns)
ctx.execute_query()
for field in site_columns:
print(f"📝 Creating field: {field.internal_name} on destination site")
try:
new_field = ctx_dest.web.fields.create_field_as_xml(field.schema_xml, field).execute_query()
except Exception as e:
print(f"An error occurred in field creation on target site: {e}")
`
new_field is created but it is not "comitted on the target site and does not show up on the target site column page.
Anything I'm doing wrong here? Is it even possible to create columns on the site level using create_field_as_xml ?
Thanks!
The text was updated successfully, but these errors were encountered: