I have probably used 100 cans of the stuff in my old house. Mostly, the mice will avoid it if they can; however,they have chewed through some holes I filled. I noticed they now sell a formula mice don't like.
Keep in mind if you foam, you still need the baffles. PM me if you want info on spraying foam yourself. I have used Foam It Green which is a do-it-yourself kit that is supposed to be ok for the environment. There are pros and cons using foam vs fiberglass.