I replaced the headliner material on my sunroof panel and used LOCTITE MR 5426 spray adhesive two years ago. It's holding firm and I'd expect the 3M version to do as well. Removal of the glass sunroof completely allows for access to the sunshade.
When fully closed note the position of the sunroof in relation the body. Mine and a few others I've worked on don't sit flush. They have been 1mm low in the front and 1mm high in the back. When you raise the sunroof to the vent position you'll have access from inside to two Torx bolts on each side of the tracks. Once the sunroof is removed and now from the top, pull the sunshade forward completely and gentle pry the rear lip down to pass under a low area in the roof. A wide stiff putty knife or similar shape works well to help coax it out, and back in. I scrapped off all the old adhesive with a wire brush before spraying on the new goo.
Some sunroof panels have metal glides to keep track of for reinstallation while other only have tabs as part of the sunshade. This is also a good time to clean and lubricate tracks. Reassembly is easy peasy.
One note of caution is the plastic finger recess to slide the sunshade open and closed. They have small tabs keeping it in place and become very brittle with age. Should you bend the sunshade too much wrestling it out, or in, you risk breaking the tabs. Removing it is also risky yet best done directly after removing the glass. ( .... don't ask how I know

)