Rename using metadata from outlook msg files


I am looking for a simple way to create renaming presents for files that I drag and drop from MS Outlook into a folder. My preferred naming would be:

To - Subject - ddyymmdd.msg (yymmdd are the date digits of the sent date)

I have tried to the renaming windows and look in the drop-down list behind 'new name.' Unfortunately, I could not find the metadata there. Is there a way to create a preset without programming? I do not know how to program, sorry.

Thank you for considering this!

Kindest regards,

This might add the info you need: Column: EML/MSG (email files) columns

Hello Leo,

I appreciate the reply. However, from what I understand from the script, it creates columns similar to the size and create date columns. Also, some suggestions are made of additional (paid for) tools that, to be honest, have too much additional functionality.

But as far as I understand, it does not show how to rename files. Or can I hide the column and use the columns to rename specifically the dropped messages? Is there a way that the metadata can appear in the drop-down list in the rename window?

Thanks for the effort!

Kindest regards,

Anything in columns can be used when renaming and will appear in the list automatically, under the Scripts section if script columns are installed.

Thanks Leo.

The script was installed quite effortlessly, and I can see that I can add the additional columns. However, in the columns, the information is incorrect and nonsensical. See for example 11.30.2021-11.58.56

As you can see, the date is not correct, and the subject is missing.

According to the post, it should work well, so I am at a loss. Is there anything I can do to fix this?

Thank you very much.

Here's a script that uses a different approach:

Hello Ixp,

Thank you, that is quite a step in the right direction. This script shows the information I need. And I can retrieve the columns in the rename window. There are just two steps I need to figure out, and I hope you can help me.

  1. The new name should be: subject - ddyymmdd.msg
    I used this in the rename window: {scp:OutlookMail/Subject} - dd{scp:OutlookMail/SentOn|yymmdd}
    However, this results in an new name: Subject - dd2021-06-07 10;14;37

I tried if adding |yymmdd would formate the date because I saw that in other places. But it has no effect.

Do yo know how to configure {scp:OutlookMail/Subject} - dd{scp:OutlookMail/SentOn|yymmdd} so the date is presented in the format yymmdd?

  1. It would be great to apply the renaming automatically when I drag and drop a file in a folder in Directory Opus. I assume that I need to use file types and there assign the renaming preset (I called the preset 'email') when a msg file is dropped in a folder. Like this:

Is that correct?

Thank you for the effort!


Try |D#yyyyMMdd

Super! This formats the renaming in the way I want. Also, when dragging and dropping the file in a folder, rename the file. However, when I drag and drop, the file is renamed but without the date part. It becomes like this:

subject.msg (the date part is missing)

When I apply the renaming preset (either using the rename window or a button), Outlook shuts down, but the file is correctly renamed to: subject - ddyymmdd.msg

I do not understand that applying the rename preset result in a missing date when dragging and dropping. And loading the preset using a button or rename window shuts down Outlook 2010.

So the preset works, but when the side effect is that Outlook shuts down. Which is very strange to me.

Do you have any suggestions?

I changed the script a bit. Let me know if you run into other/new problems, like high memory usage.

With the new script, Outlook does not shut down anymore. The only remaining issue is that when I drag & drop the file, it is renamed to 'subject.msg'. When I press the button when this file is selected, it is renamed to 'subject - ddyymmdd.msg'. Both drag and drop and the button refer to the same renaming preset.

I am afraid that's a timing problem. The columns need the file to be in a defined place in order to extract the fields. That might not be the case when it gets drag'n'dropped, so the fields remain empty. Not sure if there is an easy solution. Then again, a button will rename all selected files, so that's not that much effort :slight_smile:

Alternatively, you could write an VBA script that starts the email export from within Outlook, giving you full control over the export path.

Thanks, Ixp, for all the effort. Because of changes in our law, we are required to store more information about clients, including certain emails. It could be 20-30 emails per day that I need to store in the client's folder. So that means an additional 20-30 times a day pushing a button as a workaround. Probably it is better after drag and drop to rename to something easy to find like zzz 01.msg. Then at the end of the day, find the files that contain zzz and rename them with the button. But then I need to remember to do this additional step. It should be possible somehow because a competing file explorer has this feature built-in.

I do not know scripting or programming, so programming something in VBA is not possible.

I appreciate the time and help.

Kindest regards,

As it turns out, rename doesn't work, because dragging an email from outlook is not covered/detected by Opus' drag-n-drop event in the File Types menu. Timing (as I had thought) is not the problem. So there is hope :slight_smile:

The bad news is: I don't know how to react to this drag-n-drop. The OnGetCopyQueueName event gets triggered, but that's about it and I wouldn't know how to work from there.

Luckily, there is still the last line of defense: @Leo

Outlook may be dropping file contents rather than an actual file. If so, the rename command (and most commands in general) would not work in that context, as there is no file to rename yet.

You'll probably have to drop the file and then rename it.

That said, the rename command in a drop event doesn't make much sense to me in general. It would be rename the source file, and not copying or moving it to the destination you dragged it to.

Hello Leo and Ixp,

Thanks for the reply.

I understand what you are saying: there is not yet a file, so it is challenging to rename it.

However, I noticed that the file does get renamed after a drag and drop but not correctly. The preset should result in 'subject - ddyymmdd.msg'. However, the file after drag and drop is renamed to 'subject.msg'. Therefore I assume that the file can be renamed after drag and drop.

Before Directory Opus, I tried for a few weeks XYplorer, and this had the drag and drop rename built-in. So there must be a way to achieve it. I decided to buy Directory Opus for various reasons, so I will not use Xyplorer now. But it would be great if there would be a solution because storing messages in clients' folders requires me to do quite frequently.

However, I understand if this is the end of the line regarding possibilities.

Kindest regards,

What you're doing here does not look right to me:

I'm surprised if the file is being created/copied/moved and also being renamed, if you only have the Rename command there and no Copy or Move command.

(Unless the rename preset is doing something unusual, like moving the file around as well as renaming it.)

If you delete that drag & drop event entirely and do the same thing, what's the result? Does it still get the same name?

Are these files being dragged out of Outlook, or between folders?

That is very odd. I never got any of these entries to fire. Maybe Outlook2010 does things differently, I only tested with Outlook2019. I'll see if I can find an older version.

Tommorow I will make a video and screenshots to show you what happens. Is there something from a logfile that you need?

I assumed that the drag and drop would automatically include saving the file from somewhere else in a folder and after that is accomplished whatever I setup will be applied. That is not correct?

It depends on what the source of the file is.

If the source is a virtual file (e.g. a block of memory the other program is passing instead of the path to a real file), then the drag & drop event will be ignored and the file will simply be created with the contents the other program passes. Nothing will be renamed in that case.

If the source is a real file, the drag & drop event would need to include the Copy command in order to copy or move it. If you just have the Rename command in the event, then it isn't going to work properly.