Set sealed property for a site column using CSOM (Delete a sealed site column sharepoint online)

There are some site columns create in our sharepoint online site which were created using the client side object model (csom) with the "Sealed" property set to True.

I now want to delete these columns, but I am unable to do so using the csom as a result of the column being sealed.

I have tried to update the field to set the Sealed property to false on the site column, but get an error, and looking at the definition of the property (msdn.microsoft.com/.../microsoft.sharepoint.client.field.sealed.aspx), it appears to be read only.

Can anyone tell me how to update the sealed property of a site column in sharepoint online using the client side object model?

Thanks in advance for any assistance!

Hi Richard,

I find you have posted another thread in our TechNet forum. I suggest you follow that post for the solution, since TechNet is the recommended forum for resolving the CSOM related issue. Also, you may consider post the error screenshot in that thread for experts there to identify the root cause.

Here is the thread link for your convenience.

Thanks for your understandings.


Regards,
Ryan

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Ryan,

Thanks for the response. Unfortunately, I have had no response on TechNet, so it is not that helpful.

Since you work for Microsoft support, are you able to find out the method and a code sample for deleting a custom sealed column in the Office 365 environment? This would prove very helpful for me, and any others in the future that run into the same issue.

Thanks in advance for your assistance!

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Actually, I don't really care how the sealed site columns are deleted, I just need a method of deleting them. The solution does not have to use csom, so if you have another method that will work to delete a sealed custom site column, please let me know.

So can anyone tell me any method at all that will allow me to delete a sealed custom site column in Office365 sharepoint online???

thanks in advance

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Richard,

Based on my research, you can try adding the following lines to the script to change the Sealed property for the affected column to “False”. Then, you can remove it via CSOM.
$schema = $field.SchemaXml
if ($schema -match 'Sealed="TRUE"')

{

    $schemaAfter = $schema.Replace('Sealed="TRUE"', 'Sealed="FALSE"')

    $Field.SchemaXml = $schemaAfter

    $Field.update()

    $ctx.ExecuteQuery()

}

else

{

    write-host "Field is ok " $schema "

}

 

If the issue remains, I’ll send you a private message to collect some information so we can try to look for a way from our side. You can check and provide the information via https://community.office365.com/user/conversations.

Thanks,
Cliff

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Cliff,

Thanks very much for getting back to me with your proposed solution. Unfortunately, I have tried this, and I have had no success - I don't get an error when updating the field with the changed schemaxml property, but the field does not get updated.

I have replied via PM to your additional information request.

thanks again for your assistance!

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Richard,

The escalated engineers has contacted you via the email address ric***@ess*** you provided. Please check your mailbox and work with them. For your reference, the email is entitled "[REG:115***] <FE> Set sealed property for a site column using CSOM (Delete a sealed site column SharePoint online) Initial Response".

Thanks,
Lingyu Sun 

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Richard,

Good to know that the issue is solved by working with the escalation team. I’d like to summarize the issue below to benefit other community members who run into the same situation:

Issue Description:
=============

Can’t remove these follow site columns in the site Affected site URL: https://a***.sharepoint.com/sites/contenttypehub

Document Purpose
External Author (if applicable)
Fraud Control Document
Issued Date
Numeric Policy Number
Owning Business Section
Policy Approved By
Policy Issue Number
Policy Number
Policy Replaces
Policy Review Date
Publish to Web
References

Root cause:
===========
The value of the AllowDeletion property in these site columns’ schema is false

Assessment:
===========

This issue can be fixed by updating the AllowDeletion property in these site columns’ schema to true, the detail code for how to update the AllowDeletion property can be found in the attached allowdeletion.txt file.

If this helps you, please let us know by marking "Yes" the post which was helpful, or answered the question.

Thanks,
Lingyu Sun

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Richard,

We've checked the escalated case and notice that all fields can be deleted via the solution above except "Document Purpose" and "Content Coordinator". Good news is that the two fields of which the schema cannot be updated are now removed from the back-end. 

Thanks for your working with us and feel free to contact back if you need further assistance.

Lingyu Sun

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Just in case anyone else runs into this, the columns that couldn't be deleted ended up having to be deleted using back end code, which cannot be done by end users. I would suggest that if you run into this issue that you raise a support call, as it is necessary to get MS support to remove them for you.

The mistake I made was to create the columns as sealed, as that was how they had been created in the 2010 on-prem environment. Not sure why some of them could be deleted, but others couldn't, but I won't be creating any sealed columns in o365 tenants in future!

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated March 20, 2021 Views 1,497 Applies to: