If he said to someone: I asked you by Allah not to do such and such, is what he said regarded as an oath?
Question

If I said to someone: I asked you by Allah not to do that, then he did it and did not care about me asking him not to do it, what is the ruling on that? And do I have to offer expiation for breaking an oath?
Praise be to Allah.Firstly:
If someone says to another person: I asked you by Allah not to do such and such, his words are not regarded as an oath. Based on that, he does not have to offer expiation if the other person does not respond to his request.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
As for his saying, “I asked you by Allah to do such and such,” this is a request and not an oath. In the hadith it says: “Whoever asks of you by Allah, give to him.” No expiation is required for that, if he does not respond to his request."(Majmu‘ al-Fatawa  1/206).
Secondly:
The one of whom a request is made by saying “by Allah” should respond to the one who makes the request, out of veneration and respect for Allah, may He be exalted, so long as the one who asked did not ask for something to which he has no right, or asked for something that would subject the one who was asked to harm or difficulty.
For more information, please see the answer to question no. 153727 for the ruling on responding to one who asks by Allah.
And Allah knows best.