none
Importing metadata to document library columns RRS feed

  • Question

  • I need to migrate a handful of doc libraries from a legacy system.  I moved all the files over to Sharepoint, but I need to get the metadata over as well.  I have it in an Excel sheet (where on column has the filename to map it).  I sort both the excel and sharepoint doc library so everything is lined up.  However, copy and paste does not work, in IE or Chrome.  

    Is there another way to get this data in there - I am not a developer.

    Thanks!

    Wednesday, July 3, 2013 9:35 PM

Answers

  • In general if you need to set specific properties that are bound to an Excel sheet, PowerShell can be the best way to go.  I;ve pasted in a sample PowerShell (source: www.sharepointdiary.com )

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

    #Function to Upload File function UploadFile($WebURL, $DocLibName, $FilePath) { #Get the SharePoint Web & Lists to upload the file $Web = Get-SPWeb $WebURL $List = $Web.GetFolder($DocLibName) #Get the Files collection from SharePoint Document Library $Files = $List.Files #Get File Name from Path $FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1) #Get the File from Disk $File= Get-ChildItem $FilePath #Set the Metadata $Metadata = @{} $Metadata.add("Department", "Sales") $Metadata.add("Location", "APAC"); #Add File to Files collection of Document Library $Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(), $Metadata, $true) #true for overwrite file, if already exists! <# Alternatively, You can set the metadata as: $UploadedFile=$Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(), $true) $UploadedFile.Item["Department"]="Sales" $UploadedFile.Item.Update() #> }

    Alternatively, there are third party tools that can automate the process for you - but PowerShell's often the path of least resistance.  I know you're not a developer, but PS isn't too dev-heavy.  Good luck!

    Chris McNulty MCSE/MCTS/MSA/MVTSP | blog http://www.chrismcnulty.net/blog | twitter @cmcnulty2000 Microsoft Community Contributor Award 2011

    Friday, July 5, 2013 1:55 PM

All replies

  • In general if you need to set specific properties that are bound to an Excel sheet, PowerShell can be the best way to go.  I;ve pasted in a sample PowerShell (source: www.sharepointdiary.com )

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

    #Function to Upload File function UploadFile($WebURL, $DocLibName, $FilePath) { #Get the SharePoint Web & Lists to upload the file $Web = Get-SPWeb $WebURL $List = $Web.GetFolder($DocLibName) #Get the Files collection from SharePoint Document Library $Files = $List.Files #Get File Name from Path $FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1) #Get the File from Disk $File= Get-ChildItem $FilePath #Set the Metadata $Metadata = @{} $Metadata.add("Department", "Sales") $Metadata.add("Location", "APAC"); #Add File to Files collection of Document Library $Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(), $Metadata, $true) #true for overwrite file, if already exists! <# Alternatively, You can set the metadata as: $UploadedFile=$Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(), $true) $UploadedFile.Item["Department"]="Sales" $UploadedFile.Item.Update() #> }

    Alternatively, there are third party tools that can automate the process for you - but PowerShell's often the path of least resistance.  I know you're not a developer, but PS isn't too dev-heavy.  Good luck!

    Chris McNulty MCSE/MCTS/MSA/MVTSP | blog http://www.chrismcnulty.net/blog | twitter @cmcnulty2000 Microsoft Community Contributor Award 2011

    Friday, July 5, 2013 1:55 PM
  • Thanks Chris, Ill give it a whirl.
    Friday, July 5, 2013 2:59 PM
  • Hi There,

    I am trying to achieve exactly the same thing, however I am battling to understand the snippet above. I do not see anywhere where you actually specify the value for the Excel file containing the metadata information, nor can I see where the document library URL is defined. I am not a developer so I would really be grateful if you could clarify this for me.

    Thanks,

    Steven

    Wednesday, July 10, 2013 12:11 PM