You might have to create an Alignment from the polyline and then create Profile / Profile view.
Or create a Featureline from the polyline and create a Profile.
Do you see any UI tools in Civil 3D which does similar job ? Other than _AeccCreateQuickProfile which Draws temporary profiles along line, arc, polyline, lot line, feature line, survey figure or selected points, I am not aware of any other UI tools. If there is an equivalent UI tool, I can investigate to find if there is any equivalent API.