none
SharePoint 2013 List Item Documents

    Question

  • Hi - Just curious if there is a way to re-associate document types in a SharePoint list that have been uploaded to a page without losing all information pertaining to each particular document?   Example: original document is InfoPath document (*.xml)...new document (same filename.pdf).  When I replace the .xml document with the .pdf document, all information pertinent to the .xml file is lost (project engineer, file path, project title, ...etc).   Any help would be greatly appreciated.  Thanks!
    Wednesday, May 03, 2017 4:12 PM

Answers

  • Hey Linda - Thank you for your helpful reply.  I will look into using this approach.  Thanks again.  Earl
    • Marked as answer by esteely Friday, May 12, 2017 1:12 PM
    Thursday, May 04, 2017 9:05 PM

All replies

  • Hi

    you can use a powershell script to copy metadata from old file to the new one


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Wednesday, May 03, 2017 9:02 PM
  • Hi esteely,

    There is no OOTB way to retain file properties when replacing the file. If we upload a file and replace the original file with this file, the properties will also be replaced.

    As Romeo mentioned, we need to get the properties from the original file, upload the file and update the properties using the PowerShell.

    Here is a demo to get the properties from the file in the library:

    # Connect to the site collection and store the object in the $site variable
    
     $site = New-Object Microsoft.SharePoint.SPSite("http://sp/sites/team")
    
     # Connect to the root site in the site collection and store the object in $root
    
     $root = $site.rootweb
    
     # Store the Shared Documents document library in a variable $Docs
    
     $docs = $root.lists["Documents"]
    
     # Display all the documents, their titles, names and IDs
    
     $docs.items | format-table -property title,name,id
    
     $title ="";
    
     foreach ($item in $docs.items)
    
     {
    
                    if($item.name -eq "excel2.xlsx"){
    
                                    $title=$item.Title
    
                    }
    
     }


    And a demo about how to upload file to the library:

    http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=487

    Best regards,

    Linda Zhang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, May 04, 2017 10:32 AM
    Moderator
  • Hey Linda - Thank you for your helpful reply.  I will look into using this approach.  Thanks again.  Earl
    • Marked as answer by esteely Friday, May 12, 2017 1:12 PM
    Thursday, May 04, 2017 9:05 PM
  • Hi esteely,

    You can mark the reply as an answer if you think it is helpful.

    It will help others.

    Best Regards,

    Linda Zhang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, May 12, 2017 2:26 AM
    Moderator