Include a link to the file that triggered the alert

Include a link to the file that triggered the alert


Have you created an alert on one of your document libraries to let your users know when a new document is added or when an existing document is modified? This works great, but the hyperlink associated with the {itemlink} token goes to the display form for your file, not the file itself. Some users expect that the hyperlink in the e-mail message will open the file for them.

doc file prop page1.pngIn other words, when your users click on the default link they see the meta data for the document in the document library and need to click on the link there to view the file. For some, this is one too many clicks.


Here is how to customize the item link so it opens the file rather than the form for this specific alert.

NOTE: In the example here, we are using a Document Library that has folders. This is a more complex issue, since the URL to the file will include the folder name. If the file is buried in several levels of folders, its even more complex since the URL must include the list of nested folders.

Follow these simple steps:

Step Action
Configure the alert. In the Event tab, specify the list or library to alert on. In this example, we will send an email alert when existing files are modified.

alert event tab.png
Configure who will receive the email message in the Recipient tab. The configuration on this tab will not impact the mail format.
On the Mail Format tab, compose the message that the e-mail recipient will get. Use the regular {itemlink} token; we will configure it later in the Options page of the Mail Format tab.

Icon-Tip Note the token {FolderName} in the email subject. This token will tell the e-mail recipient the folder the modified file was in.

mail format tab1.png

Using the above mail format with the default {itemlink}, an email from this alert will look like that shown below.

example email with default itemlink.png

Icon-Warning IMPORTANT: Note the URL for the item. We will use it when configuring the custom URL.

Because we don’t want the default behavior of the {itemlink} token, we need to adjust it on the Options page of the Mail Format tab.

custom item link on options page.png

Add a Custom Item Link by entering a URL in the box provided. The default link from the email example above looks like this:


In order to link to the file, we need to change the URL to include the folder name (if one exists) and the name of the file, which is stored in the Name column of the library.

The new link is:


This Custom Item Link applies only to this alert. Notice that we used a token {FolderPathName}. This is different than the token {FolderName} we used in the subject line of the email. {FolderPathName} is usually the best choice to use unless you are sure that no subfolders will ever be created.

  • {FolderName} includes just the name of the specific folder where the file resides.
  • {FolderPathName} includes the site (or sites if the library is in a subsite; the server or web app name is NOT included in this token), library name, and list of nested folders with slashes appropriate for a path. For example, if my file is in a folder call Folder A1 which itself is in a folder called Folder A, I need to use the {FolderPathName} to get the name of the nested folders where the file resides.

Icon-WarningIMPORTANT: Token names are case sensitive! If you use a token {foldername}, you won’t see any data. You must use {FolderName}.