There have been a lot of studies performed that show that vitamin D helps prevent cancer, but overall there are even more studies that show no effect.
No effect on breast cancer.
No effect on colorectal cancer.
Mixed results for prostate cancer.
Vitamin D production in the skin seems to decrease the risk of several solid cancers.
Improving calcium and vitamin D nutritional status substantially reduces all-cancer risk in postmenopausal women.
Vitamin D and/or calcium supplementation also showed no overall effect on CVD, cancer, and mortality.
This meta analysis concluded "the effect estimate for vitamin D supplementation with or without calcium for... cancer (seven trials, 48 167 patients)... lay within the futility boundary, indicating that vitamin D supplementation does not alter the relative risk of any of these endpoints by 15% or more."
Molecular basis of the potential of vitamin D to prevent cancer.