Setting "Parent Socket" of SkeletalMeshComponent in C++

I am trying to set the socket of a skeletal mesh component in C++ - it’s easy to do purely in blueprints, but I need to be able to do it in C++. Here’s what I want:
image

Here’s what I get:
image

It’s read only, so I need to set it in code. I’ve tried:

FAttachmentTransformRules AttachmentRules(EAttachmentRule::KeepRelative, true);
skeletalMeshComponent->AttachToComponent(GetMesh(), AttachmentRules, FName("spine_03"));

and

skeletalMeshComponent->SetupAttachment(GetMesh(), FName("spine_03"));

Neither work. Any help would be much appreciated. :slight_smile: