Sure you can, although the results are not going to tell you much other than it's carbon steel.
I have had to do this in the past for certain clients. They are particularly concerned if the job has multiple alloys, it's insurance that they didn't get mixed up, and also that correct weld metal was used.
I have even sorted CS with an XRF gun. They said that all of the material was from one heat, but the Mn and Si contents were distinctly different on some pieces. You could use portable OE to get carbon values.