Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. # Load SharePoint library
  2. [system.reflection.assembly]::LoadWithPartialName("Microsoft.Sharepoint")
  3.  
  4. # Connect to the site collection http://SP2010 and store the object in the
  5. $site variable
  6. $site = New-Object Microsoft.SharePoint.SPSite("http://SP2010")
  7.  
  8. # Connect to the root site in the site collection and store the object in $root
  9. $root = $site.rootweb
  10.  
  11. # Store the Shared Documents document library in a variable $Docs
  12. $docs = $root.lists["Shared Documents"]
  13.  
  14. # Display all the documents, their titles, names and IDs
  15. $docs.items | format-table -property title,name,id
  16.  
  17. # Updates the title for each item in the list with Name
  18. $docs.items | ForEach { $_["Title"] = $_["Name"]; $_.Update() }
  19.  
  20. # Display all the documents, their titles, names and IDs
  21. $docs.items | format-table -property title,name,id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement