The female plug for the E31 sunshade switch is 5 or 6-pin
3-2-1
6-5-4 (6 is no pin)
but it is not listed as single item in the E31 parts list, probably part of the complete wire loom.
The switch has the part number 61311383488
here is a picture of the plug with pigtail, but no part number can be seen
Looks like the same switch is used on E36