I have a HtmlWidget with an IdentityPart with an Id value like “/Identifier=40b3f227-61af-4d8b-95c9-53bd6021a70e”.
<HtmlWidget Id="/Identifier=40b3f227-61af-4d8b-95c9-53bd6021a70e" Status="Published">
<IdentityPart Identifier="40b3f227-61af-4d8b-95c9-53bd6021a70e" />
....
What would be the right way to delete a widget like this in code?
I assume we grab the object using the contentmanager somehow and delete or unpublish it. But I am not sure about the exact mechanics of doing that. Would appreciate an example and some guidance on the approach.
Basically you retrieve the item the item using the content manager as you have suggested. For example if you wanted to retrieve the item by its identity:
Then you pass the retrieved content item back to the content manager to remove or unpublish: