As the title says, I need to export messages to PC exactly as they are stored in the phone together with relevant metadata. How can I do that?
I have a Nokia Lumia 930.
There are apps which can export your messages, either directly from the phone or from its cloud backups, into useful formats.
contacts+message backup - First-party app from Microsoft that runs on your phone and backs up your messages to a file on your Documents folder or SD card. The file is only really intended for restoring on another phone but it's a reasonably comprehensible format.
Windows Phone Message Backup - Third-party app for phone or PC, uses cloud backups (you have to give it access to your Microsoft account). Supports multiple export formats and search.
There are a few other, older ones - some even date back to WP7.x, though they only worked on unlocked (jailbroken) phones - but one of those should suit you well enough.
Also in addition you can upload your text messages on cloud and restore later on any other windows phone device but no direct way to export to PC.
Windows Phone has no way of exporting your messaging history.
You can backup your messages to OneDrive, but this backup can only be restored to another Windows Phone during setup after a hard reset.
The only other option I can come up with is transfering the messages for example to an Android device and export them from there. But I don't know which apps would support that, sorry.