"Here is a simple experiment we did one summer afternoon in Kamilche Point, Washington. We compared several forms of organically grown shiitake mushrooms, which had starting level of 100 IU/100 grams. We compared the vitamin D levels of three sets of mushrooms, all from the same crop. The first was grown and dried indoors. The second set was dried outdoors in the sunlight with their gills facing down. The third set of mushrooms was dried outdoors in the sunlight with their gills facing upwards for full sun exposure. The most vitamin D was found in shiitake dried with gills up that were exposed to sunlight for two days, six hours per day. The vitamin D levels in these mushrooms soared from 100 IU/100 grams to nearly 46,000 IU/100 grams (see chart). Their stems, though, produced very little vitamin D, only about 900 IU. Notably, vitamin D levels dropped on the third day, probably due to over-exposure to UV."
It's worth noting that this is Paul Stamets' work. He's definitely worth the google search if you've never heard of him and are into this sort of thing - super interesting guy. He is not educated as a scientist though so I usually take most of his stuff with a grain of salt.