When does the sheaf direct image functor f_* have a right adjoint? Say f: X → Y is a morphism of schemes.  The sheaf direct image functor f★ always has a left adjoint, namely the sheaf inverse image functor f★ (with tensoring).

Under what (sufficient) conditions do we know that f★ has a right adjoint?  What is it?

Answer to a related question (edit): If f★ preserves quasicoherence, then its restriction to quasicoherents f★: QCoh(X) → QCoh(Y) has a right adjoint when f is affine (in particular, any closed immersion or finite morphism will do).  The basic idea is to globalize the affine case (see Eric Wofsey's answer below); thanks to Pablo Solis for pointing me to page 6 of Ravi Vakil's notes explaining this.
In this question, I'm not restricting to the quasi-coherent categories.  One reason for working with non-quasicoherents is that j! , the "extension by zero" right adjoint to j★ for an open immersion j, doesn't take qcoh to qcoh.
 A: If $f_\ast$ has a right adjoint, it must preserve colimits and hence be right-exact. Thus a necessary condition is that the higher derived functors vanish.  In particular, when everything is affine and we have $X=\operatorname{Spec} B$ and $Y=\operatorname{Spec} A$, then I believe the adjoint exists and is given by $M \mapsto \operatorname{Hom}_A(B,M)$.
A: Provided that $X$ is quasi-compact and separated and $f$ is separated then what is true is that $Rf_\ast \colon \operatorname{D}(X) \to \operatorname{D}(Y)$ has a right adjoint $f^!$ where these are the unbounded derived categories of sheaves of modules with quasicoherent cohomology. This is the Grothendieck duality functor. Its existence can be viewed as a consequence of the fact that $Rf_\ast$ in such a situation preserves coproducts. It is worth mentioning I guess that sometimes one does not need such big derived categories to produce an adjoint (for instance if $X$ and $Y$ are smooth and projective over some field).
One gets a right adjoint on the level of abelian categories of all sheaves of modules corresponding to the inclusion of a closed subscheme as well namely the inverse image of the subsheaf with supports.
There is the obvious cheat that if $f \colon X \to Y$ is an isomorphism then the adjoint pair you know gives an equivalence so that $f^\ast$ is also right adjoint to $f_\ast$.
A: We sometimes (when !!??) have a second adjoint pair $(f_!,f^!)$ between the sheaf categories where $f_!$ is direct image with proper support and $f^!$ is a right adjoint. Now when $f$ is proper on has $f_!=f_*$ , so $f^!$ is right adjoint to $f_*$ . 
You can find out what it does by adjoint yoga with the sheaf-Homs: $\mathcal{Hom}(f_*F,G)=\mathcal{Hom}(F,f^!G)$.
Set $F=O_X$. Then $(f^!G)(U)=\mathcal{Hom}(O_X(U)$, $f^!G(U))=\mathcal{Hom}((f_* O_X)(U), G(U))$. If you can determine the latter you know more. This is a very general answer, but it can help in concrete situations, boiling down the question to the knowledge of $f_*O_X$.
If you don't know whether the right adjoint exists, you can also try to define one via this equation.
A: For your question. 
i agree with the answer from Greg, but in a different formalism. He used derived category. I did not. If f:X--->Y is a morphism of scheme. Then if f is affine morphism. Then direct image functor f_* :Cx---->Cy, has right adjoint functor f^!. Where Cx and Cy are category of sheaves or in particular, category of quasi coherent sheaves. So, in general, what we need is only the scheme is quasi compact and quasi separated.(I believe the quasi compact can be dropped, but I need some time to check globalization, I believe the flag variety of affine Kac-Moody algebra which is not quasi compact lies in this case).
The reference is 
M.Kontsevich and A.Rosenberg
Noncommutative spaces and flat descent. MPIM preprint
There is another related question. In category of quasi coherent sheaves. Say, if we have scheme morphism X---->Y, we always can get inverse image functor f^*: QcohY--->QcohX. But the direct image functor does not always exist. But if the scheme we are talking about is quasi compact and quasi separated. It exists. There is of course weaker condition. For this case, one can see the following papers:
1 D.Orlov Quasi coherent sheaves in commutative and noncommutative geometry
2 M.Kontsevich, A.Rosenberg. Noncommutative stack MPIM preprint 
3 SGA 6  
