Using Portal Keys from Capsule
Solution 1:
When an inventory item is inside a Capsule, it is in storage and cannot be used. For example, XMPs inside a Capsule can’t be fired and Keys can’t be used to recharge or link Portals.
https://support.google.com/ingress/answer/6011315?hl=en
Solution 2:
I'm equally sure you're mistaken.
Keys in capsules are not visible for linking.