I have a document library with lots of contracts and a column for expiration date.

I want to make a timeline and show the expiration date for each of the contracts.

At this time, whats my option to use data from my Document Library to create Task and integrate into timeline?

So: Sharepoint 2013; Document Library's column A (File Name from uploaded pdf files), column B (Expiration Date) >>> ??????? >>>>> Timeline Display?

1 Answer 1


So from my point of view you have a few things you need to do here.

  1. If you don't want to use your site's task list, create a new task list, otherwise you can use the one currently on your site.
  2. Create a new SharePoint 2013 WF and attach to your document library.
    • Configure it to run when an item is added
    • My suggestion is to add the step "Wait for Field Change in Current Item" and point it at your expiry date (unless that is a required field). This way you workflow will not fire until the expiry date is set.
    • Next add a step to create a new item in the task list. Set the due date to the expiry date document and set the title to the name of the document.
    • If you want to get fancy you can add a hyperlink field to your task list that points back to your document (Laura Rogers has a great explanation of this: http://www.wonderlaura.com/Lists/Posts/Post.aspx?ID=196)

To deal with the documents you have already you are going to have to whip out some PowerShell:

$spWeb = Get-SPWeb <URL of Site>
$spSourceLib = $spWeb.TryGetList(<LibraryName)
$spDestTaskList = $spWeb.TryGetList(<ListName>)
$libRoot = $spSourceLib.RootFolder()    #need even if you don't have folders.
$listItems = @()
GetFileList($libRoot, $listItems)

foreach($listItem in $listItems)
  $newTaskItem = spDesTaskList.Items.Add();
  $newTaskItem["Title"] = $listItem["Name"];
  $newTaskItem["DueDate"] = $listItem["ExpireDate"]

function GetFileList($spFolder, $listItems)
  #First deal with the files.
  foreach($spFile in $spFolder.Files)
    $spItem = $spFile.Item;
    $listItems += $spItem;

  #next recursively call for each folder in library
  foreach($spSubFolder in $spFolder.SubFolders)
    #make sure it isn't the bultin forms folder
    if($spSubFolder.Name -ne "Forms")
      GetFileList($spSubFolder, $listItems;)

From here you should just need to create your time line. Please note: I wrote the powershell from "the hip", I haven't had a chance to test it, but it should be correct enough for you to complete it for your needs.

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.