SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using powershell to read a csv file and then uploading the file to sharepoint. However, I would like to rename the file. how is it done? Is it done before I load the file from fileshare to document library. or during the add method. I am not sure. Please let me know.

$sourceFile = Get-ChildItem $i.FileLocation
$newFile = $docLibrary.RootFolder.Files.Add($destinationFolderPath,$sourceFile.OpenRead(), $true)
share|improve this question
up vote 0 down vote accepted

$theItem = $newFile.Item
$theItem["Name"] = $i.newfilename

where i is file stream and newfilename is the column name for new file name.

This works for me.

share|improve this answer
Thank you so much. RIGHT ON THE TARGET. – Maria Burton Jun 29 '12 at 0:32

One other post here was answering something similar upload file to document library

Pay attention to the last part when name is changed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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