<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Vault Datastandards 2019 - folder structure - copy files in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/vault-datastandards-2019-folder-structure-copy-files/m-p/8541701#M5501</link>
    <description>&lt;P&gt;Ive got the following code i'm trying to get it to copy all the files within my folder structure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;function recursivelyCreateFolders($targetFolder, $sourceFolder)&lt;BR /&gt;{&lt;BR /&gt; $sourceSubFolders = $vault.DocumentService.GetFoldersByParentId($sourceFolder.Id,$false)&lt;BR /&gt; foreach ($folder in $sourceSubFolders) {&lt;BR /&gt; $newTargetSubFolder = $vault.DocumentServiceExtensions.AddFolderWithCategory($folder.Name, $targetFolder.Id, $folder.IsLibrary, $folder.Cat.CatId)&lt;BR /&gt; $newTargetFiles = $vault.DocumentService.GetLatestFilesByFolderId($folder.Id, $false)&lt;BR /&gt; &lt;BR /&gt; &lt;FONT color="#FF0000"&gt;foreach ($file in $newTargetFiles) {&lt;/FONT&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;FONT color="#FF0000"&gt; $newTargetPath=$newTargetSubFolder.FullName+"/"+$file.Name&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;$FileSelectionId = [Autodesk.Connectivity.Explorer.Extensibility.SelectionTypeId]::File&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt; $FileLocation = New-Object Autodesk.Connectivity.Explorer.Extensibility.LocationContext $FileSelectionId, $newTargetPath&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt; $vaultContext.GoToLocation = $FileLocation&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt; }&lt;/FONT&gt;&lt;BR /&gt; }&lt;BR /&gt; recursivelyCreateFolders -targetFolder $newTargetSubFolder -sourceFolder $folder&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jan 2019 22:17:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-01-22T22:17:01Z</dc:date>
    <item>
      <title>Vault Datastandards 2019 - folder structure - copy files</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/vault-datastandards-2019-folder-structure-copy-files/m-p/8541701#M5501</link>
      <description>&lt;P&gt;Ive got the following code i'm trying to get it to copy all the files within my folder structure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;function recursivelyCreateFolders($targetFolder, $sourceFolder)&lt;BR /&gt;{&lt;BR /&gt; $sourceSubFolders = $vault.DocumentService.GetFoldersByParentId($sourceFolder.Id,$false)&lt;BR /&gt; foreach ($folder in $sourceSubFolders) {&lt;BR /&gt; $newTargetSubFolder = $vault.DocumentServiceExtensions.AddFolderWithCategory($folder.Name, $targetFolder.Id, $folder.IsLibrary, $folder.Cat.CatId)&lt;BR /&gt; $newTargetFiles = $vault.DocumentService.GetLatestFilesByFolderId($folder.Id, $false)&lt;BR /&gt; &lt;BR /&gt; &lt;FONT color="#FF0000"&gt;foreach ($file in $newTargetFiles) {&lt;/FONT&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;FONT color="#FF0000"&gt; $newTargetPath=$newTargetSubFolder.FullName+"/"+$file.Name&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;$FileSelectionId = [Autodesk.Connectivity.Explorer.Extensibility.SelectionTypeId]::File&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt; $FileLocation = New-Object Autodesk.Connectivity.Explorer.Extensibility.LocationContext $FileSelectionId, $newTargetPath&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt; $vaultContext.GoToLocation = $FileLocation&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt; }&lt;/FONT&gt;&lt;BR /&gt; }&lt;BR /&gt; recursivelyCreateFolders -targetFolder $newTargetSubFolder -sourceFolder $folder&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 22:17:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/vault-datastandards-2019-folder-structure-copy-files/m-p/8541701#M5501</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-22T22:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Vault Datastandards 2019 - folder structure - copy files</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/vault-datastandards-2019-folder-structure-copy-files/m-p/8541875#M5502</link>
      <description>&lt;P&gt;Also need to know how to attach properties to these sub folders. and the files.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;function recursivelyCreateFolders($targetFolder, $sourceFolder)&lt;BR /&gt;{&lt;BR /&gt; $sourceSubFolders = $vault.DocumentService.GetFoldersByParentId($sourceFolder.Id,$false)&lt;BR /&gt; foreach ($folder in $sourceSubFolders) {&lt;BR /&gt; $newTargetSubFolder = $vault.DocumentServiceExtensions.AddFolderWithCategory($folder.Name, $targetFolder.Id, $folder.IsLibrary, $folder.Cat.CatId)&lt;BR /&gt; $FolderProperties = GetFolderProperties -folder $folder&lt;BR /&gt; &lt;FONT color="#FF0000"&gt;#need code to update folder properties on $newTargetSubFolder&lt;/FONT&gt;&lt;BR /&gt; $newTargetFiles = $vault.DocumentService.GetLatestFilesByFolderId($folder.Id, $false)&lt;BR /&gt; &lt;BR /&gt; foreach ($file in $newTargetFiles) {&lt;BR /&gt; &lt;BR /&gt; $newTargetPath=$newTargetSubFolder.FullName+"/"+$file.Name&lt;BR /&gt; $FileProperties = GetFolderProperties -file $file&lt;BR /&gt; &lt;FONT color="#FF0000"&gt;#need code to update folder properties on the new file&lt;/FONT&gt;&lt;BR /&gt; $FileSelectionId = [Autodesk.Connectivity.Explorer.Extensibility.SelectionTypeId]::File&lt;BR /&gt; $FileLocation = New-Object Autodesk.Connectivity.Explorer.Extensibility.LocationContext $FileSelectionId, $newTargetPath&lt;BR /&gt; $vaultContext.GoToLocation = $FileLocation&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; recursivelyCreateFolders -targetFolder $newTargetSubFolder -sourceFolder $folder&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 23:31:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/vault-datastandards-2019-folder-structure-copy-files/m-p/8541875#M5502</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-22T23:31:14Z</dc:date>
    </item>
  </channel>
</rss>

