SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

How do I set a metadata (say CustomerID or Skills) with PowerShell? I am trying to fill CustID. Edited. This is the working version of the final powershell code.

Here is the working code....

$siteURL="http://Server"
$docLib = "My Doc Lib"
$site=Get-SPSite $siteURL
$web=$site.RootWeb
$collFiles=$web.GetFolder($docLib).Files
$count=$collFiles.Count
while($count -ne 0)
{
$item = $collFiles[$count-1].Item
$DocSet = $item["Region"]
Write-Host "$DocSet is the doc set. $collFiles[$count-1].Name is name"
$collFiles[$count-1].MoveTo($siteURL + "/" + $docLib + "/" + $DocSet + "/"  + $collFiles[$count-1].Name, $true)                       
$count--
}
share|improve this question
up vote 0 down vote accepted

Here is the working code....

$siteURL="http://Server"
$docLib = "My Doc Lib" 
$site=Get-SPSite $siteURL 
$web=$site.RootWeb 
$collFiles=$web.GetFolder($docLib).Files 
$count=$collFiles.Count 

while($count -ne 0) 
{
 $item = $collFiles[$count-1].Item 
 $DocSet = $item["Region"]
 Write-Host "$DocSet is the doc set. $collFiles[$count-1].Name is name"
 $collFiles[$count-1].MoveTo($siteURL + "/" + $docLib + "/" + $DocSet + "/"  + $collFiles[$count-1].Name, $true)                       
$count-- 
} 
share|improve this answer

Your Answer

 
discard

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.