You can't do it with a simple method supplied with Revit API (why they didn't foresee it ???) . But you can do the following dirty trick, which works for me:
private void moveParameter(FamilyParameter fPar, BuiltInParameterGroup fromGroup, BuiltInParameterGroup toGroup)
{
Definition def = fPar.Definition;
ParameterType pType = def.ParameterType;
bool isShared = fPar.IsShared;
bool isInstance = fPar.IsInstance;
if (isShared)
{
ExternalDefinition eDef = InitSharedParameterFileInfo.GetSharedParameter(def.Name);
fPar = FamilyManager.ReplaceParameter(fPar, "tempParameter", toGroup, isInstance);
FamilyManager.ReplaceParameter(fPar, eDef, toGroup, isInstance);
}
else
{
ExternalDefinition eDef = getTempExternalDef(pType, fPar);
fPar = FamilyManager.ReplaceParameter(fPar, eDef, toGroup, isInstance);
FamilyManager.ReplaceParameter(fPar, def.Name, toGroup, isInstance);
}
}
So you need an intermediate step, from shared to non-shared, from non-shared to shared again. Or vice versa.
For non-shared you will need a set of dummy shared parameters to serve as the intermediate step.
Another problem is that you want to move shared parameter, you should have its definition in your shared parameter file, as you cannot cast from FamilyParameter to ExternalDefinition unfortunately.