Element.Pinned usage?

Sorry to necro this thread.

Based on the discussion above and at the post below

I am trying to use the python script to pin/unpin elements, but to no avail.
The idea is to make sure that all elements are unpinned before they are modified.


This is the dynamo graph output.

The error popping up is
“Warning: Element.SetPinnedStatus operation failed. Element cannot be pinned or unpinned.”

image

On revitAPI docs it shows its an " [Autodesk.Revit.Exceptions InvalidOperationException]
which further defines this as “The exception that is thrown when a method call is invalid for the object’s current state.”
I don’t understand what revit is trying to tell me.

Any help is appreciated.
– Aditya