1

I would like to change Core Document Columns and some other columns (id, name, title, created by, version etc) through SharePoint cmdlet, is it possible?

My idea is using loop and give columns data through excel sheet

    foreach (fileName in $tblNeme)
    {
      if(tblFileName == libFileName)
          {
              ID = tblID;
              Version = tblVersion;
              CreatedDate = tblCreatedDate;
           }
     }

I am a developer but not working before on SharePoint cmdlet.

Kindly suggest me correct code or easiest way to change metadata columns in Document Center.

0

I wouldn't recommend changing the ID, see this thread: List item with specific ID value

As for the Modified and CreationDate and even Author, you may look to this blog:

Pasted code excerpt from blog:

#Add the SharePoint snapin
Add-PSSnapin Microsoft.SharePoint.Powershell -ea SilentlyContinue

#set the web url and the list name to work upon
$url = "http://sharepoint/sites/cthub"
$listName = "Shared Documents"
$fileName = "FileName.xlsx"

#Get the appropriate list from the web
$web = get-SPWeb $url
$list = $web.lists[$listName]

#Get the file using the filename
$item = $list.Items | ? {$_.Name -eq $fileName}

#Set the created by values
$userLogin = "domain\username"
$dateToStore = Get-Date "8/11/2015"

$user = Get-SPUser -Web $web | ? {$_.userlogin -eq $userLogin}
$userString = "{0};#{1}" -f $user.ID, $user.UserLogin.Tostring()


#Sets the created by field
$item["Author"] = $userString
$item["Created"] = $dateToStore

#Set the modified by values
$item["Editor"] = $userString
$item["Modified"] = $dateToStore


#Store changes without overwriting the existing Modified details.
$item.UpdateOverwriteVersion()
  • thank, i try this solution then give you feedback. – abdullah altaf Aug 12 '15 at 4:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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