Document Library Modified Dates

Hi,
We're currently moving a lot of file resources into document libraries, and one thing we've noticed is that SharePoint shows the modified date as the date the file was migrated not the actual last modified date from the file.
This is causing some users discomfort as they work from those modified dates to do their job, and now they're all the same
In Explorer View the dates show as we expect them. It's when you use the browser, or when you use Open File in Office and browse to a document library.
I wondered is there any way of adding the Last Modified Date of the file into the view of a document library?
Many Thanks,
Andrew
Andrew France - http://andrewsprivatecloud.wordpress.com

I'm not sure about files that have already been uploaded to SharePoint - from what I've noticed that changes the modified date on the file as well.  You can adjust it on the upload though if you script it, I've used the below script to accomplish this
in the past.  It will go through the specified folder, uploading all files, keeping folder structure intact, and adjust the SharePoint modified date/time to that of the file.
May not be exactly what you're looking for, but hopefully will help.
#change these values as required, filepath is files to upload, sitename is the sharepoint web name, listname is obvious
$filepath = "<folder location>"
$sitename = "<sharepoint web>"
$listname = "<list name>"
if(!(Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue))
{ Add-PSSnapin Microsoft.SharePoint.PowerShell }
function recurse_dir()
param ([string]$fileUploadPath, [string]$parentFolderName="")
#go through each file in the directory provided and upload
foreach ($file in (dir $fileUploadPath))
$newlocation=""; $newlocationfolder=""
if ($file.Attributes -eq "Directory")
if ($parentFolderName -ne "") {$newlocation=$parentFolderName+"/"}
$newlocation+=$file.name
$newFile = ($list.rootfolder).subfolders.add("$newlocation")
Write-Output "Added directory ""$file"" to $listname/$newlocation"
if ($parentFolderName -eq "") {$newlocationfolder=$newfile.parentfolder.url + "/"}
$newlocationfolder+=$newlocation
recurse_dir -fileUploadPath $file.fullname -parentFolderName $newlocationfolder
else
$newFile = ($list.rootfolder).files.add($file.name,$file.OpenRead(),$true)
$fileitem = $newfile.item
$fileitem["Modified"]=$file.LastWriteTime
$fileitem.Update()
$newlocation = "$parentFolderName/$file"
if ($parentFolderName -ne "")
$newfile.MoveTo($newlocation)
$newFile.Update()
$list.Update()
Write-Output "Uploaded ""$file"" to $newlocation"
$newfile = $null
$fileitem = $null
$list = (get-spweb $sitename).lists[$listname]
recurse_dir -fileUploadPath $filepath

Similar Messages

  • How to get document library column data through Programmatically

    HI,
    I have one scenario..here i have to get the particular document library column data...Like fetching List data.
    In LIST We will do LIke this:
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
                using (SPWeb web = site.OpenWeb())
                    SPList list = web.Lists["ListName"];
                    SPListItem item = list.Items.Add();              
                    item["Title"] = txtTitle.Text;
    item.update()
       But here we want to fetch  data from document library column data....
    I did following way....can any one suggest me....
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
                using (SPWeb web = site.OpenWeb())
                    SPDocumentLibrary documentLib = web.Lists["DocumentName"] as SPDocumentLibrary;
                    SPListItem items = documentLib.Items.Add();
    Thanks.....

    Hi,
    The code that you have posted is adding data to the list or document library. Do you want to add or fetch data from or to document library?
    You can refer following link for Inserting/Updating documents in document library:
    http://blogs.perficient.com/microsoft/2009/04/working-with-documents-stored-in-sharepoint-document-library-programmatically/
    For fetching data from document library, you can use following code:
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    string documentLibName = "Doc_Lib_Name";
    SPFolder docLibrary = web.GetFolder(documentLibName);
    foreach (SPFile file in docLibrary.Files)
    var customColValue = file.Item["Custom_Column_Name"];
    Hope this helps!
    Regards, Shruti

  • How to set a list form field data value that is linked to another document library's data when the link gets broken!!??

    In summary, I have created 3 document libraries and one issues list in a site collection.
    The issues list has a form that has mainly been created in SharePoint 2010 but tweaked in InfoPath 2007 and one of the fields links to the title of a document in the first document library (so an issue can be linked/referenced to a particular document).
    This all works great until I want to move a document (using the workflow that I built) from document library 1, to document library 2 or 3 as this is what I've set up to move documents through the business process we are taking it through.
    When this happens, the link between the issue that was raised originally against the document is broken and therefore you can no longer tell which document the issue is linked with.
    Does anyone know a way of 'setting' the field that is linked to data in another document library on original selection/creation of the issue, so that when the link is broken the original data remains.
    Any ideas welcome as I am stomped!!! 
    Cheers!!
    Louis Maxwell

    
    Hi  Louis,
    According to your description, my understanding is that you want to keep the link field of the issue list working after moving the linked document.
    Whether the link field  is a lookup column or not ?
    If so, due to the information source of  lookup column cannot be changed, you need to add other lookup fields for document library 2 and document library 3. Just one lookup column corresponds one document
    library. Then you can update the lookup column in the workflow when move the linked document. Such as when a document is moved to document library 2, you need to clear the lookup1 field (corresponding document library 1) and update the lookup2 field (corresponding
    document library 2).
    For updating the lookup column, you can refer to the following actions:
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Edit Form in Document Library missing data

    When I try to create a new Edit Form for a Document Library in SP Designer 2013 the new form is missing the Name field.  The people picker field doesn't do lookups anymore either.  Like the Java is broke. 
    When I tried to do the same thing on a Drop Off Library for content management same thing as above plus documents stopped submitting.
    Anyone know how to do this?  Am I missing something?
    David Jenkins

    Hi,
    I understand the frustration you are having when using SharePoint Designer 2013 to create custom forms for SharePoint Library.
    Since there seems no direct way in SharePoint Designer 2013 to create custom forms in a smooth way as expected, an effective way I would suggest is that you can submit a feedback in the Office Developer Platform, it is a place for customers provide feedback
    about Microsoft Office products. What’s more, if a feedback is high voted there by other customers, it is promising that Microsoft Product Team will take it into consideration when designing the next version in the future.
    http://officespdev.uservoice.com/
    As a workaround, if solution with custom code is accepted in your scenario, I suggest you create a totally new page(not form page) for this library use only. We can use the common web developing technology to design the style, there are also rich exposed
    APIs can be called for the data accessing(such as uploading file, updating item). It would be more flexible to create custom solution in this way comparing to the limited functionalities provided in SharePoint Designer 2013. 
    Thanks for your understanding.
    Best regards      
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Lisa Chen
    TechNet Community Support

  • How to sort pdf documents by modified date using Javascript action

    Hello,
    I want to use a Javascript action to sort multiple pdf documents in a folder before I run a Javascript action that prints the last page of multiple pdf documents.  I received help from this forum on the last page print script and it works perfectly.  The downside is it prints in default NAME order and I need them to print in accending DATE MODIFIED order.  I'm not sure if the sort function could be incorporated into the print script or if it would be a seperate code/action.
    This is the script to print the last page of several pdf documents:
    this.print
    ({bUI: false,
    nStart:this.numPages-1,
    bSilent: true,
    bShrinkToFit: true});
    I would appreciate help from anyone that is willing to share the code to "sort by DATE MODIFIED".
    Adobe Acrobat 10 Pro
    Windows 7
    Thank you in advance,
    David C.

    I'm not a code writer.  I'm trying to streamline some operations here at work.  The original code assistance was to print the last page of several pdf documents (sometimes as many as 100 to 150 at a time) without having to open each file, scroll to the bottom, Ctrl-P, current page, Print.  Can't express how beneficial it was to get that to work.  I realize I'm looking a gift horse in the mouth, but when it prints out, it would be great to have them print in DATE MODIFIED order since they are kept in processed order rather than alpha order.
    If the two processes are too labor intensive I fully understand and appreciate all the assistance thus far.  I was hoping it would be as simple as the first script coding to do the actual printing.
    Thanks,
    David C.

  • Document Library "Modifed By" is Equal to [Me]

    Hi All,
    I have one small requirement,  we have one Site in that site  contain one Document Library,   My requirement is who ever upload the documents into that library they want to see just there Documents only, they don't want to see other person
    Documents. Who is having Site Collection Administrator access Or Full Control they can see all Documents > How i need to achieve this one Please help me
    First i have tried like this way  - For Others i have Given Contribute Permissions and then  I have given Filter on Default View  for that Document Library  "Modified by" is Equal to [Me] then who is uploading the document they
    are seeing those documents only, but  Site Collection Administrator Not able to see the all other documents .   Is there any way to achieve this requirement using OOB Feature . 
    If in case if it is not possible using OOB Feature then give idea on how to develop this one please guys help me..
    Thanks,
    Venkata.
    J V Varaprasad.

    Hi,
    According to your description, you want to accomplish that the person only could see the documents uploaded by themselves, but site Collection Administrator can see all Documents.
    After given Filter on Default View 
    for that Document Library  "Modified by" is Equal to [Me], site Collection Administrator not able to see others’ documents too.
    I think you should give Filter on
    All document View  for that Document Library 
    "created by" is Equal to [Me] rather than
    “Modified by” is Equal to [Me].
    For your issue, let your site collection admin
    create a personal view that doesn't have this filter applied and make it as the default view.
    Best Regards,
    Lisa Chen

  • Writing modified date of a document library item through CSOM.

    I´m working on an application which is replicating files from one document library to another. Since it is a replication, I want the modified date to be preserved when I copy the file from the source library to the target, so that the user will see the real
    modified date in the target library and not the date of the replication run.
    I access SharePoint through the client side object model and I have been able to set the modified date on a SharePoint 2010 on-premise using the following straght-forward code:
    var listItem = list.GetItemById(id);
    context.Load(listItem);
    context.ExecuteQuery();
    listItem["Modified"] = "03/11/1999";
    listItem.Update();
    context.ExecuteQuery();
    Unfortunately when I execute the same code on any other SharePoint (2013 On-Premise, 2013 Online or 2010 Online) the code will execute without any errors, but the modified date will not be changed at all.
    My actual question is: Is there any possibility to change the modified date throught CSOM on all of these SharePoint-versions?

    I got a work around for this problem..
    Before updating the Modified, Modified By values, First we need to Disable the version settings for document library. Once the fields updated then again we need to enable the version settings. 
    find the updated code below..
                                          //Disable Version settings for DOC LIB
    before update Metadata
                                            _List.EnableVersioning
    = false;
                                            _List.Update();
                                            _cContext.ExecuteQuery();
                                           ListItem item = newFile.ListItemAllFields;
                                           _cContext.Load(item);
                                            //Updating Metadata Created,
    CreatedBy, Modified, Modified By
                                             item["Created"]
    = "8/10/2013 7:04 PM";
                                             item["Author"] = CreatedUserValue;
                                             item["Modified"] = "8/10/2013 7:04 PM";
                                             item["Editor"] = ModifiedUserValue;
                                             item.Update();
                                            _cContext.ExecuteQuery();
                                            //Enable Version settings
    for DOC LIB after update Metadata
                                               _List.EnableVersioning
    = true;
                                              _List.Update();
                                            _cContext.ExecuteQuery();
    Rajendra

  • Sharepoint 2013, Document Library: Sharepoint is changing data in a single line of text column to ISO8601 after modifying other columns

    Hello there,
    basically, as the title says: We have a Document Library on a Sharepoint 2013. Attached to every document are multiple columns, the type for every column is 'Single line of text'.
    One column is called 'billing date' and has suitable data in it, e.g. 01.01.2015, 26.02.2015, 29.03.2015 an so on.
    Sometimes when someone is editing an other column of the same document the data in 'billing date' changes from 01.01.2015 to 2015-01-01T00:00:00Z for that document, seemingly randomly.
    Is there any way to configure or prevent this?
    Thanks in advance and kind regards,
    Michael

    Hi,
    From your description, my understanding is that SharePoint changes the format of date in single line.
    It is very strange issue. I try to reproduce your issue in my environment, but everything is OK.
    To solve your issue, I need to collect some information, please confirm these points below:
    When will the format of date change? Does it change immediately when you edit the document or after clicking save button?
    Does the issue occur in this document library or each one in your environment?
    Do you have some special configurations for this document library?
    In addition, could you provide a screenshot as below?
    Best Regards,
    Vincent Han
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Archive/Move files based on Modified Date range to another Library Using PowerShell while retaining Metadata

    Hi,
    I am trying to archive files from a SharePoint 2010 document library by moving them to another library that's a dedicated archive/folder/library. The files to be moved are selected based on their modified date column value that should range between any time
    in the past to January 1st 2012. 
    Also, to be able to retain the tags and cloumn values after the move. Open in explorer does not bring along the user added tags.
    I tried to edit this script
    $WebURL = "http://mysite.com/";
    $ListDisplayName = "Crawl Test Library";
    $ArchiveFolderName = "Crawl Test Library Archive";
    function moveItems ()
    trap
    #make sure we dispose of these in the event of an error to avoid memory leaks:
    write-host "Error - disposing of objects...";
    $Web.Dispose();
    $Site.Dispose();
    [Microsoft.SharePoint.SPSite] $Site = New-Object Microsoft.SharePoint.SPSite($WebURL);
    [Microsoft.SharePoint.SPWeb] $Web = $Site.OpenWeb();
    [Microsoft.SharePoint.SPList] $List = $Web.Lists[$ListDisplayName];
    $FolderToMoveTo = $List.RootFolder.Url + "/" + $FolderName;
    $ItemMoveCount=0;
    $Query = New-Object Microsoft.SharePoint.SPQuery;
    $Query.Folder = $list.RootFolder;
    $camlQuery = "<Where><Leq><FieldRef Name='Modified' /><Value Type='DateTime'>2012-01-01T00:00:00Z</Value></Leq></Where>"
    $Query.Query = $camlQuery
    $Query.RowLimit = 2200; #limit query because of large folder
    $List.GetItems($Query) |
    Where {$_.ContentType.Name -ne "Folder"} |
    foreach-object {
    #Line below will simply output to console and demonstrates another .NET call
    [System.String]::format("Moving Item {0} with ID {1}...",$_.Name, $_.ID.ToString());
    $Web.GetFile($_.Url).MoveTo([System.String]::format("{0}/{1}",$FolderToMoveTo,$_.Name));
    write-host "Success...";
    $ItemMoveCount++;
    write-host "==============================================================================";
    write-host "Complete! -> Moved " $ItemMoveCount " Items to directory " $FolderName;
    write-host "==============================================================================";
    #dispose:
    $Web.Dispose();
    $Site.Dispose();
    #garbage collection
    [GC]::Collect()
    to do that but it doesn't seem to work. I am no guru in powershell yet so any help is appreciated.
    Thanks.

    This solution gets the job done. Much thanks to
    Ian Hayse
    NB...The Modified and Created dates are gonna reflect runtime dates now 
    $web = Get-SPWeb "http://sharepointed.com/"
    $list = $web.Lists["Shared Documents"]
    $spQuery = New-Object Microsoft.SharePoint.SPQuery
    $spQuery.ViewAttributes = "Scope='Recursive'";
    $spQuery.RowLimit = 2000
    $caml = '<Where><Lt><FieldRef Name="Created" /><Value IncludeTimeValue="TRUE" Type="DateTime">2014-01-01T04:06:45Z</Value></Lt></Where> '
    $spQuery.Query = $caml
    do
    $listItems = $list.GetItems($spQuery)
    $spQuery.ListItemCollectionPosition = $listItems.ListItemCollectionPosition
    $listTotal = $listItems.Count
    for ($x=$listTotal-1;$x -ge 0; $x--)
    try
    $listItems[$x].CopyTo("http://sharepoint/Docs/Documents/"+ $listItems[$x].name)
    Write-Host("DELETED: " + $listItems[$x].name)
    $listItems[$x].Recycle()
    catch
    Write-Host $_.Exception.ToString()
    while ($spQuery.ListItemCollectionPosition -ne $null)

  • Error while creating a new report data source in Sharepoint Document library

    I installed SSRS(sql server 2012 SP1) in my sharepoint 2013 farm(single server installation).
    I have installed SSRS addin for report also. 
    I created a document library and included the report data source content type, report builder report and report builder model content types. On click of any of these content types i get the below error. 
    "new Document requires a Microsoft SharePoint Foundation-compatible application and web browser. To add document to document library, click on the 'Upload' button."
    I am using windows 7 64-bit operation system with Google chrome and IE 8 64 bit.
    Any help would be appreciated. 

    Rakesh, is this an SSRS question?
    This doesn't look like Power View.
    Thanks!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • How do I show/refresh data from an Access Web App in an Excel spreadsheet saved in a Document Library on Sharepoint 2013 online

    I have an Access 2013 Web App in my Sharepoint 2013 online website. It contains a query to report on its data (several, actually, but let's keep it simple). I want to connect an Excel spreadsheet to the query, visualise the data in pivot tables/graphs/whatever,
    save the spreadsheet in a Document Library, and let other team site Sharepoint users open the spreadsheet (preferably in Excel online, but with Excel client if it has to be) and see/copy the data, refreshed with the latest information from the Access Web App.
    Simple, surely!
    The way I'm doing it at the moment is to create an ODC file to connect to the cloud-based Access 2013 database, save that ODC in a Data Connection Library in the SP site, and use the saved ODC file as data source in the Excel spreadsheet. This works and
    successfully keeps everything 'in the cloud' but I can't get it to refresh in Excel Online, and if I open the spreadsheet in Excel Client I have to enter the database password every time to refresh it. I don't really want to issue this password to everyone
    who might want to view the data. There must be a better way than this ODC method, I suspect.
    Googlings on this have led down various blind alleys - Excel Services, PowerPivots, Web Parts - but I'm stuck on which to follow through. Please, someone, point me to an article/book/website that explains how to do this step-by-step in simple language..
    thanks
    Jonathan

    I don't see any quick way of achieving it - at least there's no such functionality exists in SharePoint. All you can do, develop an event receiver that will update the fields in the list item once the excel file is added/updated. You can use OpenXml API
    to manipulate the excel file.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • Getting Modified date of a particular document in KM Content

    Hi,
    Can I fetch the modified date of a particular document from KM Content?
    I know  i can find the date in settings -> properties. But I want to fetch the value of modified date/time.
    I want to save that  modified date/time in particular attribute in a program developed in NWDS so that I can proceed with my code depending on modified date/time.
    Please guide me.
    Regards
    Simin

    Belw code snippet gives me the Modified date for the document RFCCall.html stored in documents folder.
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
              IUserContext uc = request.getUser();
              IUser user = (IUser)uc.getUser();
              ResourceContext ctxt = new ResourceContext(user);
              RID rid = RID.getRID("/documents/RFCCall.html");
              IResource resource;
              try {
                   resource = ResourceFactory.getInstance().getResource(rid, ctxt);
                   response.write(resource.getLastModified().toString());
              } catch (ResourceException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    You need to add a sharing reference to knowledgemanagement for this to work.
    Regards
    Prashant

  • PPS Error in "IBIMonitoringAuthoring " You do not have permissions to create a data source in this document library.

    Hi,
    I am trying to use "IBIMonitoringAuthoring" in my local web site.
    But i am getting error like "Server was unable to process request. ---> You do not have permissions to create a data source in this document library.  Additional details have been logged for your administrator."
    My code is below,
     string url = ServerName + webServiceUrl;
            IBIMonitoringAuthoring biService = BIMonitoringAuthoringServiceProxy.CreateInstance(url);
            //Create data source object
            DataSource dataCube = new DataSource("AW_Data_Cube");
            dataCube.Name.Text = "AW_Data_Cube";
            dataCube.ServerName = "SQL2008dev";
            dataCube.DatabaseName = "Analysis Services Project1";
            dataCube.CubeName = "TestCube";
            dataCube.ConnectionContext = ConnectionContext.ConnectAsSharedUser;
            dataCube.FormattingDimensionName = "Measures";
            dataCube.MinutesToCache = 10;
            dataCube.CustomTimeIntelligenceSettings = "";
            biService.CreateDataSource(connectionListUrl, dataCube);
    How could i authenticate the Service. Is there any way to pass credentials for this method?
    Thanks & Regards
    Poomani Sankaran

    I suffered similar issue in Infopath, and i finally solved the issue by changing the data connection URL, it should the same as the Infopath publish location.
    for example: SP server iP 192.168.1.1 have two name, hostname is mySP, alternate assces mapping name is companySP, and you can access the websit by both
    http://mySP and
    http://companySP
    hope it can help someone..

  • Create excel file in document library from the data in datatable

    Hi ,
    I want to generate files dynamically and have then saved to my documetn library instead of  some location on the  harddisk.
    I want to generate and excel file  which will read data from the sharepoint list.
    Form that data excel will be genereated in the code ,and i want the generated excel directly available in the  document library.
    I could use open xml of excel itneroperablity for the excel file generation.
    How can i do that.

    Hi,
    According to your description, you might want to gather data from a SharePoint list as an excel file and upload it to a Document Library.
    As you said, you can generate an Excel file using the Open XML SDK, I will provide some information about how to get data from SharePoint list and how to upload files
    to a Document Library.
    About the retrieving data from a SharePoint list, we can use SharePoint Object Model:
    SharePoint Object Model -
    SPListItem class
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.aspx 
    Add, Update and Delete List Items Programmatically in SharePoint
    http://www.mindfiresolutions.com/Add-Update-and-Delete-List-Items-Programmatically-in-Sharepoint-372.php 
    About
    How to: Upload a File to a SharePoint Site from a Local Folder:
    https://msdn.microsoft.com/en-us/library/office/ms454491(v=office.14).aspx
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Patrick Liang
    TechNet Community Support

  • Add data to excel which is already in document library

    hi im new to sp2013,
    i need to add/fill data to the excel sheet-1 , i.e, which is already in the sharepoint document library and that too in sheet-1 only because, i had a macro on excel which is on doc lib, so i need to fetch data from list and to fill data to sheet-1 programatically
    or OOTB.
    thanks in advance

    The OOB way uses a data connection to retain link to a live SharePoint list.  You could possibly try exporting this data connection file (via the Data --> Data Connections dialog box) and importing that within your Report.XSLX
    If that's not sufficient, I imagine you'd need to create something with a VBA Macro.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

Maybe you are looking for