I have already talked about the popular “Today” trick, and explained how you can get the same result by simply using the [Modified] column:
I have a strange feeling about this. People who have been using this trick for years don’t believe me (which makes me doubt), but at the same time they can’t prove me wrong.
Anyway, let’s move on and review the “Me” trick.
The “Me” trick is similar to the “Today” trick, here are the steps (for details, see the above link):
1/ Create a text column called “Me”
2/ Create your calculated column(s) where you can use [Me] in the formulas
3/ Delete the [Me] column – this is mandatory for the trick to work
4/ If later you need to modify your calculated columns, remember to re-create the [Me] column
– the “Me” trick will return the user’s login, not his/her display name.
– like the “Today” trick, the field is only modified when you update the list item. So you should actually understand [Me] as the last user who modified the item.
If so, why not simply use the [Modified by] column? Well, if you try, SharePoint will return an error message:
One or more column references are not allowed, because the columns are defined as a data type that is not supported in formulas.
Columns of type “Person or Group” are not allowed in formulas. So the [Me] trick can help you bypass this limitation. Nevertheless, keep in mind that the “Today” and “Me” tricks are not supported by Microsoft.
How about “Created by”?
If you want to reference in a formula the user who created the list item, you need a different approach. As before, you’ll fail if you try to include [Created By] in your formula.
Instead, create a column of type “Text” – let’s call it “TheAuthor” for example – with as default value: = [Me]. The column will automatically be populated with the user’s login (not the display name), and you can use this column in formulas.
One limitation: the default value is just proposed by SharePoint, users can overwrite the field (unlike the above “Me” trick).
I’ll dedicate a future post to [Today] and [Me] in a more useful context: the filtering of list views.
I just came across an example using [Today] in the “Default value” field:
This relies on the real [Today] feature offered by SharePoint, not the (useless and not supported) trick…
Sorry could not paste the sourcecode – it got discarded…
Can i send it to you Christophe so you can review it and maybe post it?
Keep up the good work!
Did you get my e-mail?
Yes Alexander, I got your e-mail.
I have received a couple scripts from readers, and as promised I’ll publish them. I just need a little time to validate the scripts and maybe add a few comments.
ok – but really can we get the display name? the login option is just ugly…
Doesn’t work in my library. Allows creation of a column but gives just gives a blank column.
You can use a PowerShell script to update a field in a SharePoint list set at either 5 mins to start of everyday to give you current date and time.
foreach($item in $list.Items)
$item[“Duration”] = “$Get-Date”
Then set it to run in task scheduler, and make sure you set the field that’s being updated to a date time field and chose whether you want just the date or date and time
Thanks for sharing Tom.
What I don’t like about this approach is that you lose track of the real modified date for the items. Not to mention concerns with versioning or alerts!