{"id":133,"date":"2016-07-06T13:08:13","date_gmt":"2016-07-06T12:08:13","guid":{"rendered":"http:\/\/www.kneefel-ict.nl\/?post_type=kbe_knowledgebase&#038;p=133"},"modified":"2016-07-19T07:37:19","modified_gmt":"2016-07-19T06:37:19","slug":"change-owner-on-all-files-in-all-document-libraries","status":"publish","type":"kbe_knowledgebase","link":"https:\/\/www.kneefel-ict.nl\/en\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/","title":{"rendered":"SharePoint: Change owner on all files in all document libraries"},"content":{"rendered":"<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n\r\n$url = &quot;http:\/\/sharepointurl\/site&quot;\r\n#Change to the correct site\r\n\r\n$SPWeb = Get-SPWeb $Url\r\n\r\n$NewSPAuthor = New-Object Microsoft.SharePoint.SPFieldUserValue($SPWeb,52, &quot;#Kneefel, L.A. (Lex)&quot;)\r\n#Change to the correct userid value and displayname\r\n#Unupported tip: Open SQL Management Studio, open the content database and open the table &#x5B;dbo].&#x5B;UserInfo]\r\n#The column &#x5B;tp_ID] contains the user id's\r\n#The column &#x5B;tp_Title] contains the displayname\r\n\r\n#Note: You have to change the Editor to change the Author.\r\n#To preserve the Original modifieddate and Editor the values are saved and later on written back\r\n\r\nforeach($list in $spweb.Lists)\r\n{\r\n\tif($list.BaseTemplate -eq &quot;DocumentLibrary&quot;)\r\n\t{\r\n\t\tforeach ($item in $list.Items)\r\n\t\t{\r\n\t\t\tIf ($list.Title -eq &quot;Master Page Gallery&quot;){continue}\r\n\t\t\tElseIf ($list.Title -eq &quot;Web Part Gallery&quot;){continue}\r\n\t\t\tElseIf ($list.Title -eq &quot;Theme Gallery&quot;){continue}\r\n\t\t\tElseIf ($list.Title -eq &quot;List Template Gallery&quot;){continue}\r\n\t\t\tElse\r\n\t\t\t{\r\n\t\t\t\t$item.Url\r\n\t\t\t\t$OriginalEditor = $item&#x5B;&quot;Editor&quot;]\r\n\t\t\t\t$OriginalEditorLoginName = $item.properties&#x5B;&quot;vti_modifiedby&quot;]\r\n\t\t\t\t$OriginalModifiedDate = $item&#x5B;&quot;Modified&quot;]\r\n\t\t\t\t$item&#x5B;&quot;Author&quot;] = $NewSPAuthor\r\n\t\t\t\t$item.Properties&#x5B;&quot;vti_Author&quot;] = $NewSPAuthor.LoginName\r\n\t\t\t\t$item&#x5B;&quot;Editor&quot;] = $NewSPAuthor\r\n\t\t\t\t$item.properties&#x5B;&quot;vti_modifiedby&quot;] = $NewSPAuthor.LoginName\r\n\t\t\t\t$item&#x5B;&quot;Modified&quot;] = $OriginalModifiedDate\r\n\t\t\t\t$Item.UpdateOverwriteVersion()\r\n\t\t\t\t$item&#x5B;&quot;Editor&quot;] = $OriginalEditor\r\n\t\t\t\t$item.properties&#x5B;&quot;vti_modifiedby&quot;] = $OriginalEditorLoginName\r\n\t\t\t\t$item&#x5B;&quot;Modified&quot;] = $OriginalModifiedDate\r\n\t\t\t\t$Item.UpdateOverwriteVersion()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$url = &quot;http:\/\/sharepointurl\/site&quot; #Change to the correct site $SPWeb = Get-SPWeb $Url $NewSPAuthor = New-Object Microsoft.SharePoint.SPFieldUserValue($SPWeb,52, &quot;#Kneefel, L.A. (Lex)&quot;) #Change to the correct userid value and displayname #Unupported tip: Open SQL Management Studio, open the content database and open the table &#x5B;dbo].&#x5B;UserInfo] #The column &#x5B;tp_ID] contains the user id&#8217;s #The column &#x5B;tp_Title] contains the displayname &hellip; <a href=\"https:\/\/www.kneefel-ict.nl\/en\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;SharePoint: Change owner on all files in all document libraries&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","kbe_taxonomy":[5],"kbe_tags":[10,11],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SharePoint: Change owner on all files in all document libraries - Kneefel ICT B.V.<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SharePoint: Change owner on all files in all document libraries - Kneefel ICT B.V.\" \/>\n<meta property=\"og:description\" content=\"$url = &quot;http:\/\/sharepointurl\/site&quot; #Change to the correct site $SPWeb = Get-SPWeb $Url $NewSPAuthor = New-Object Microsoft.SharePoint.SPFieldUserValue($SPWeb,52, &quot;#Kneefel, L.A. (Lex)&quot;) #Change to the correct userid value and displayname #Unupported tip: Open SQL Management Studio, open the content database and open the table &#x5B;dbo].&#x5B;UserInfo] #The column &#x5B;tp_ID] contains the user id&#039;s #The column &#x5B;tp_Title] contains the displayname &hellip; Continue reading &quot;SharePoint: Change owner on all files in all document libraries&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/\" \/>\n<meta property=\"og:site_name\" content=\"Kneefel ICT B.V.\" \/>\n<meta property=\"article:modified_time\" content=\"2016-07-19T06:37:19+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/\",\"url\":\"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/\",\"name\":\"SharePoint: Change owner on all files in all document libraries - Kneefel ICT B.V.\",\"isPartOf\":{\"@id\":\"https:\/\/kneefel-ict.nl\/#website\"},\"datePublished\":\"2016-07-06T12:08:13+00:00\",\"dateModified\":\"2016-07-19T06:37:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kneefel-ict.nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Knowledgebase\",\"item\":\"https:\/\/kneefel-ict.nl\/en\/knowledgebase\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SharePoint: Change owner on all files in all document libraries\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kneefel-ict.nl\/#website\",\"url\":\"https:\/\/kneefel-ict.nl\/\",\"name\":\"Kneefel ICT B.V.\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/kneefel-ict.nl\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kneefel-ict.nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kneefel-ict.nl\/#organization\",\"name\":\"Kneefel ICT B.V.\",\"url\":\"https:\/\/kneefel-ict.nl\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kneefel-ict.nl\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/i1.wp.com\/www.kneefel-ict.nl\/wp-content\/uploads\/2016\/01\/logo_kneefel-ict-1200x280dpi.jpg?fit=1200%2C280&ssl=1\",\"contentUrl\":\"https:\/\/i1.wp.com\/www.kneefel-ict.nl\/wp-content\/uploads\/2016\/01\/logo_kneefel-ict-1200x280dpi.jpg?fit=1200%2C280&ssl=1\",\"width\":1200,\"height\":280,\"caption\":\"Kneefel ICT B.V.\"},\"image\":{\"@id\":\"https:\/\/kneefel-ict.nl\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SharePoint: Change owner on all files in all document libraries - Kneefel ICT B.V.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/","og_locale":"en_US","og_type":"article","og_title":"SharePoint: Change owner on all files in all document libraries - Kneefel ICT B.V.","og_description":"$url = &quot;http:\/\/sharepointurl\/site&quot; #Change to the correct site $SPWeb = Get-SPWeb $Url $NewSPAuthor = New-Object Microsoft.SharePoint.SPFieldUserValue($SPWeb,52, &quot;#Kneefel, L.A. (Lex)&quot;) #Change to the correct userid value and displayname #Unupported tip: Open SQL Management Studio, open the content database and open the table &#x5B;dbo].&#x5B;UserInfo] #The column &#x5B;tp_ID] contains the user id's #The column &#x5B;tp_Title] contains the displayname &hellip; Continue reading \"SharePoint: Change owner on all files in all document libraries\"","og_url":"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/","og_site_name":"Kneefel ICT B.V.","article_modified_time":"2016-07-19T06:37:19+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/","url":"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/","name":"SharePoint: Change owner on all files in all document libraries - Kneefel ICT B.V.","isPartOf":{"@id":"https:\/\/kneefel-ict.nl\/#website"},"datePublished":"2016-07-06T12:08:13+00:00","dateModified":"2016-07-19T06:37:19+00:00","breadcrumb":{"@id":"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kneefel-ict.nl\/knowledgebase\/change-owner-on-all-files-in-all-document-libraries\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kneefel-ict.nl\/"},{"@type":"ListItem","position":2,"name":"Knowledgebase","item":"https:\/\/kneefel-ict.nl\/en\/knowledgebase\/"},{"@type":"ListItem","position":3,"name":"SharePoint: Change owner on all files in all document libraries"}]},{"@type":"WebSite","@id":"https:\/\/kneefel-ict.nl\/#website","url":"https:\/\/kneefel-ict.nl\/","name":"Kneefel ICT B.V.","description":"","publisher":{"@id":"https:\/\/kneefel-ict.nl\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kneefel-ict.nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/kneefel-ict.nl\/#organization","name":"Kneefel ICT B.V.","url":"https:\/\/kneefel-ict.nl\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kneefel-ict.nl\/#\/schema\/logo\/image\/","url":"https:\/\/i1.wp.com\/www.kneefel-ict.nl\/wp-content\/uploads\/2016\/01\/logo_kneefel-ict-1200x280dpi.jpg?fit=1200%2C280&ssl=1","contentUrl":"https:\/\/i1.wp.com\/www.kneefel-ict.nl\/wp-content\/uploads\/2016\/01\/logo_kneefel-ict-1200x280dpi.jpg?fit=1200%2C280&ssl=1","width":1200,"height":280,"caption":"Kneefel ICT B.V."},"image":{"@id":"https:\/\/kneefel-ict.nl\/#\/schema\/logo\/image\/"}}]}},"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/kbe_knowledgebase\/133"}],"collection":[{"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/kbe_knowledgebase"}],"about":[{"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/types\/kbe_knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/comments?post=133"}],"version-history":[{"count":4,"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/kbe_knowledgebase\/133\/revisions"}],"predecessor-version":[{"id":145,"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/kbe_knowledgebase\/133\/revisions\/145"}],"wp:attachment":[{"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/media?parent=133"}],"wp:term":[{"taxonomy":"kbe_taxonomy","embeddable":true,"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/kbe_taxonomy?post=133"},{"taxonomy":"kbe_tags","embeddable":true,"href":"https:\/\/www.kneefel-ict.nl\/en\/wp-json\/wp\/v2\/kbe_tags?post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}