It may be worth of a few more words about the third method. It creates a temporary shared parameter file and switch the current shared parameter file over regardless of what it is, creates the named shared parameter in a temporary DefinitionGroup, creates a type binding or instance binding accordingly for the shared parameter, adds the Binding to the BindingMap got from the ParameterBindings property of the Revit Document of concern, and finally switches back to the original shared parameter file.
Unfortunately I'm on paternity leave so can't post code, but if you break down that paragraph into steps it's totally possible.
Out of interest, I used it to create a text Project Info parameter - which surprisingly can be multi-line - that I write XML into. Hello Saved Settings! If you use BIM link, you will see that they have made an XML project parameter like this on you project.