Exactly, if the OP is an established member here, who we know is really motivated, I would not have any problem with giving him the full solution right in the first reply. Unfortunately with new members we are more likely to stick with the rules.
QUOTE
(I even offered to remove my post),
Appreciated, that's why I wrote that it is not lost, and it'll be put back, because you had work in it, and it was a exactly a contribution that makes the site great!
QUOTE
it just looked to me that the OP already showed some effort, and linking to the API docs saying "use this function" is a bit rough
You are right, but if that first snippet was his work, I think linking the docs was just enough to push him into the right direction. I really agree with Programmist, that it is essential to learn to use the API docs - and just as important to learn to use google. I think that the ideal flow of things would be this: OP asks a question, he is given some documentation, he tries to use it, he posts his answer. If it works fine, then he thanks us

If it can be improved, or he has problems, then the cavalry can come in. Also, reading the docs is important, because hopefully he'll read the things near the answer, and it gives him a better understanding of the whole picture.