- Introduction
- Getting Started
- How To Guides
-
Command Reference
- Overview
- Asset Commands
- Attribute Definitions
- Category Commands
- User Group Commands
-
PowerDAM Operations
- Export-MvDamAssetAttribute
- Export-MvDamAssetInfo
- Import-MvDamAssetAttributeFromCsv
- Import-MvDamAssetCategoryFromCsv
- Import-MvDamAssetKeywordFromCsv
- Import-MvDamAssetStatusFromCsv
- Import-MvDamFilenameListFromCsv
- Test-MvDamAssetAttributeCsv
- Import-MvDamAssetsFromContainer
- Export-MvDamContainerManifest
- Import-MvDamCategoryTreeFromManifest
- Initialize-MvDamUploadJob
- Start-MvDamUploadJob
- Import-MvDamAssetsFromHotFolder
- Creative Spaces Operations
- SkyHOOK Commands
- Solution Recipes
Exporting asset info into a CSV
You can export MediaValet DAM asset info into a CSV file by querying the MediaValet and exporting it. You can query by:
- Asset Id or an Asset Id list (Get-MvDamAssetInfo using By Asset Id or By Asset Id List)
- Filename or filename list (Get-MvDamAssetInfo using By Filename or By Filename List)
- A search query (Find-MvDamAssetInfo using a SearchQuery)
These commands all return an array of AssetInfo objects. So using Powershell, you can pipe the results directly to a CSV.
Query by a list of asset Ids and export the matching asset info list to a csv file
#Create an array of asset Ids $idList = @("b9aef90c-82fd-4fda-a60e-b9325942d62e","7e6a6baf-599c-40a8-9995-0e8176661721","80e97dea-214a-4cd0-a9b4-c24b86bf2633") #Execute the Get-MvDamAssetInfo cmdlet and pipe the results to a CSV file (Get-MvDamAssetInfo -IdList $idList) | Export-Csv -Path "C:\Temp\assetinfo.csv"
In the preceding example, you created variable $idlist
to store a Powershell array of strings @("b9aef90c-82fd-4fda-a60e-b9325942d62e","7e6a6baf-599c-40a8-9995-0e8176661721","80e97dea-214a-4cd0-a9b4-c24b86bf2633")
. In PowerShell, an array has the syntax @()
.
Alternatively, you could also directly pass the string array the -IdList parameter. The pipe |
will send the results of the Get-MvDamAssetInfo
cmdlet to the Export-Csv
cmdlet with a -Path
parameter specifying the file path where you want the exported CSV saved.
The DAM can be queried by a filename or a list of filenames as well.
Query by a list of filenames, store it in an array variable and export results
#Store the asset info for "DSC_0001.jpg" and "DSC_002.jpg" into $assets $assets = Get-MvDamAssetInfo -FilenameList @("DSC_0001.jpg","DSC_002.jpg") # Pipe the asset info array to a CSV $assets | Export-Csv -Path "C:\Temp\assetinfo.csv" -NoTypeInformation
In addition to Id and Filename queries, you can run your own search query and export this to a CSV. You can store this into a PowerShell array variable as well and do subsequent queries on the results
Query by a list of filenames, store it in an array variable and export results
#Store the search results into an asset info array $assets = Find-MvDamAssetInfo -SearchQuery "june campaign" #List the assets but only display the Id, Title, Filename and export to CSV $assets | Select -Property Id, Title, Filename | Export-Csv -Path "C:\Temp\basic_asset_info.csv" -NoTypeInformation #Only export the PNG files into exported-asset-info.csv $assets | Where {$_.FileType -eq "PNG"} | Export-Csv "C:\Temp\exported-asset-info.csv" -NoTypeInformation #Add all assets file a filename like *DSC* to exported-asset-info.csv $assets | Where {$_.FileName -like "*DSC*"} | Export-Csv "C:\Temp\exported-asset-info.csv" -Append -NoTypeInformation
BONUS: MediaValet PowerDAM operations
If you already have a list of filenames in CSV format that you would like to convert into a MediaValet Asset Info csv that you can edit and subsequently import back into the DAM, you can use some MediaValet import and export cmdlets. Just make sure that the CSV containing the filenames has a header row labeled Filename.
Create a filename array named
$filenames
from a source CSV file$filenames = Import-MvDamFilenameListFromCsv -Path C:\Temp\Filenames.csv
Use the
$filenames
to Export an asset info CSV with keywordsExport-MvDamAssetInfo -FilenameList $filenames -Path C:\Temp\assetlist-for-editing.csv
In order to export the asset info to CSV with attributes, use the Export-MvDamAssetAttribute cmdlet instead
#Get assets from the Filenames $assets = Get-MvDamAssetInfo -FilenameList $filenames #Export Asset with Attributes Export-MvDamAssetAttribute -AssetInfoList $assets -Path C:\Temp\export-assetattribute-full.csv
If the DAM library a lot of attributes and you only want to select a few attributes, you can pass an array of attributes that you want to export.
Export-MvDamAssetAttribute -AssetInfoList $assets -AttributeList @("Brand","Campaign","Project","ClientId") -Path C:\Temp\export-assetattribute-selected.csv
These exported CSV files can be edited/updated with the values you want to load back into the MediaValet DAM. Look at the instructions in this documentation for Importing Asset Keywords from Csv and Importing Asset Attributes from Csv.
Importing Asset Keywords from CSV
Before you can import asset keywords from CSV, you need to have an asset info export file available and populated with the keywords. For the import, the required columns are Id and Keywords. The rest of the columns for generated by the asset info export are not needed although they are useful for providing the user with a filename reference when the CSV is being updated with the keywords.
Before you proceed with an import, please check the following:
- The System.Id columm does not contain any
<<NOT FOUND>>
or<<MULTIPLE>>
values. If the export file was generated from a filename list and it does not find a matching filename, the System.Id will show up as<<NOT FOUND>>
. If multiple matches were found, then the System.Id will show<<MULTIPLE>>
on the System.Id column and the System.Description will provide a list of asset Ids that match the filename.
Once you have verified that the CSV with keywords is ready for import, you can execute the following command:
Import-MvDamAssetKeywordFromCsv -Path C:\Temp\export-assetinfo-keywords-edited.csv
This will update the corresponding assets in the DAM with the Keywords
in the CSV specified in the -Path
parameter.
Importing Asset Attributes from CSV
After exporting an asset with attribute info into a CSV file, you would typically edit that file and add the attribute values that you would like to load back into the DAM. If you used a filename list CSV as your source file for exporting the asset info, the exported file follows the same sequence as your source filename list. So if you already have attributes defined in the source filename list, you can populate the attributes through a simple copy and paste operation from your source CSV.
Before you proceed with an import, please check the following:
-
The System.Id columm does not contain any
<<NOT FOUND>>
or<<MULTIPLE>>
values. If the export file was generated from a filename list and it does not find a matching filename, the System.Id will show up as<<NOT FOUND>>
. If multiple matches were found, then the System.Id will show<<MULTIPLE>>
on the System.Id column and the System.Description will provide a list of asset Ids that match the filename. -
The attribute names used in the header of the file match the custom attributes you will be updating. If you did not touch the header of the exported file from the Export-MvDamAssetAttribute cmdlet, then everything should be good. But if you added a new column for an attribute, then you need to make sure that the name matches the
Name
when you runGet-MvDamAttributeDef
-
The data type entered for the attribute columns match the data type of the attribute in the DAM. You can run the
Get-MvDamAttributeDef
cmdlet to get a list of attribute definitions that include the data type. For example, if you have an attribute such as “Publication Count” to denote the number of times the asset has been used in a published ad or a marketing collateral and the Attribute Type isInteger
, you should not enter a string value such as “one” but instead use1
. A quick way to test this is to run theTest-MvDamAssetAttributeCsv
command.
This validates the export-assetattribute-edited.csv and logs the error(s) import-assetattribute-validation.csv (if any)
Test-MvDamAssetAttributeCsv -SourcePath >C:\Temp\export-assetattribute-edited.csv -ResultPath >C:\Temp\import-assetattribute-validation.csv
Once you have verified that the source CSV file with the attributes is correct and ready for import, you can execute the Import-MvDamAssetAttributesFromCsv
cmdlet.
Import-MvDamAssetAttributesFromCsv -SourcePath C:\Temp\export-assetattribute-edited.csv -LogPath C:\Temp\import-assetattribute-log.csv
The -SourcePath
is the full file path of the edited CSV file that you want to import the values from. Although specifying a log file is optional, it is best practice to specify a log file just in case errors are encountered along the way. The Import-MvDamAssetAttributesFromCsv
will continue to run the next item in the CSV file being imported even if it encounters an issue. You can retrieve this manually from the $Error
PowerShell variable in your session which contains an array of errors that have been encountered in your session. But it is easier to look at the transaction info status in the log file.
Importing Asset Categories from CSV
In order to import asset categories from a CSV, you will need a need a file that at a minium contains the assets’ Id as well as the path of the category you wish to add. If you need to add multiple categories to an asset they need to be individual entries in your file. If you only have the file names of the assets in question you can run the asset info export command, you will then need to add the category paths before importing.
Before you proceed with an import, please check the following:
-
The System.Id columm does not contain any
<<NOT FOUND>>
or<<MULTIPLE>>
values. If the export file was generated from a filename list and it does not find a matching filename, the System.Id will show up as<<NOT FOUND>>
. If multiple matches were found, then the System.Id will show<<MULTIPLE>>
on the System.Id column and the System.Description will provide a list of asset Ids that match the filename. -
Category paths are segmented strings of folders and subcategory sperated by ‘/’ or ‘'. For example “Parent/SubCategory/SubSubCategory”. The root library category is implicit.
Once you have verified that the CSV with keywords is ready for import, you can execute the following command:
Import-MvDamAssetCategory-Path C:\Temp\export-assetinfo-categories-edited.csv
This will update the corresponding assets in the DAM with the Path
in the CSV specified in the -Path
parameter.
Deduping assets prior to upload
The standard method of ingesting all assets uploaded by a customer is documented at Import-MvDamAssetsFromContainer
If you need to dedupe assets before they get ingested into the DAM, you will need to run the steps individually and include additional deduping commands. Assuming that you are ingesting from the Azure Blob container https://mvonboarding.blob.core.windows.net/customer and you plan to use C:\Uploads\customer as your work folder, then you need to create a SAS uri for the Blob container that you can access from your local machine and decide on a local job folder that will be used for reports and logging. You can assign this to a variable such as:
$SasContainerUri = <your SAS URI goes here>
$JobFolder = "C:\Uploads\customer"
If you plan to upload the assets to a specific category, you can also specify a $ParentCategoryPath for the incoming assets.
$ParentCategoryPath = "\Root\ParentCategoryName"
Once you have your environment variables setup, you can follow these steps:
- Catalog the contents of the blob container through the -SrcSasUri. This step in the process uses Export-MvDamContainerManifest and create a job folder to hold all job processing info. This will create an asset-manifest.csv file that includes a ContentMD5 hash field that will be used for deduping.
Export-MvDamContainerManifest -SrcSasUri $SasContainerUri -JobFolder $JobFolder -ParentCategoryPath $ParentCategoryPath
Optional: You can generate a dupe report that you can share with your customer at this stage before proceeding. For example, you can generate a report at C:\Uploads\customer\DupeReport.csv throught the following command:
Export-MvDamDupeAssetReport -JobFolder $JobFolder -ReportFilePathCsv $JobFolder\DupeReport.csv
- Remove the dupes from asset-manifest.csv and put them into $JobFolder\dupes-to-categorize.csv and $JobFolder\dupes-to-resolve.csv. dupes-to-categorize.csv will be used to add the duplicate file with the same filename to other categories is the DAM that corresponds to the source locations of the dupe. dupes-to-resolve.csv needs to be manually addressed because these are the same files with a different name. These can be added back to the asset-manifest.csv if the customer just wants to upload them or the names can be adjusted to match the original to that the asset is just referenced in various categories. This is performed using:
Split-MvDamAssetManifestForDeduping -JobFolder $JobFolder
- Ensure that the categories cataloged in the category-manifest.csv file in the job folder already exists. If they do not exist, it will create it. This operation is performed using
Import-MvDamCategoryTreeFromManifest -JobFolder $JobFolder
- Analyze the ingestion workload and group the assets into batches and sequence them for processing using the Initialze-MvDamUploadBatch. This will divide the asset-manifest.csv into batches for uploading:
Initialize-MvDamUploadJob -JobFolder $JobFolder
- Process the batches in the job according to sequence and distribute the workload accordingly by using Start-MvDamUploadBatch. It is recommended to use azcopy for large files so you need to install azcopy before running this command:
Start-MvDamUploadJob -JobFolder $JobFolder -UseAzCopy
- Add categories to the asset where a duplicate was found. This is accomplished through:
Import-MvDamAssetClassificationFromDupeCsv -JobFolder $JobFolder