Joints and orientations

I have a maya animation scene of a skinned model.

I can go through each frame by:

MTime time;
time.setValue(iFrame);
MAnimControl::setCurrentTime(time);

But how do I go through each frame and get the orientations(quaternions) for each joint (kJoint) ?

thanks....