This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$impexp = get-ImportExportServiceClient | |
$contentFolderSelection = new-object SubTreeSelection "tcm:3-1005-2",$false | |
$exportInstruction = new-object ExportInstruction | |
$exportInstruction.BluePrintMode = [BluePrintMode]::ExportSharedItemsFromOwningPublication | |
($processId = $impexp.StartExport( @($contentFolderSelection),$exportInstruction)) | |
WaitForImportExportFinish $impexp $processId | |
DownloadPackageToFile $processId "package.zip" | |
$uploadId = UploadPackageFromFile "package.zip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get-ImportExportServiceClient { | |
param( | |
[parameter(Mandatory=$false)] | |
[AllowNull()] | |
[ValidateSet("Service","Upload","Download")] | |
[string]$type="Service" | |
) | |
InitImportExport | |
$binding = new-object System.ServiceModel.BasicHttpBinding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<system.serviceModel> | |
<bindings> | |
<basicHttpBinding> | |
<binding name="ImportExport_basicHttpBinding" maxReceivedMessageSize="41943040"> | |
<readerQuotas maxStringContentLength="41943040" maxArrayLength="41943040" /> | |
<security mode="TransportCredentialOnly"> | |
<!-- For LDAP or SSO authentication of transport credentials, use clientCredentialType="None" --> | |
<transport clientCredentialType="Windows" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function InitImportExport{ | |
if (-not $global:ImportExportIsInitialized) { | |
Add-Type -assemblyName System.ServiceModel | |
Add-Type -Path 'C:\Program Files (x86)\Tridion\bin\client\ImportExport\Tridion.ContentManager.ImportExport.Client.dll' | |
Add-Type -Path 'C:\Program Files (x86)\Tridion\bin\client\ImportExport\Tridion.ContentManager.ImportExport.Common.dll' | |
Import-Module Reflection | |
Import-Namespace Tridion.ContentManager.ImportExport | |
Import-Namespace Tridion.ContentManager.ImportExport.Client | |
$global:ImportExportIsInitialized = $true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Depends on PowerShell Reflection module (http://poshcode.org/search/Reflection) | |
# Depends on Tridion Powershell Modules (http://code.google.com/p/tridion-powershell-modules/) | |
$autoLocalize = $true | |
import-module Tridion-CoreService | |
$core = Get-TridionCoreServiceClient | |
import-module Reflection | |
import-namespace Tridion.ContentManager.CoreService.Client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Depends on Tridion Powershell Modules (http://code.google.com/p/tridion-powershell-modules/) | |
function createPublication { | |
Param( | |
[parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
$core, | |
[parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$title, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// componentUri is a TcmUri representing the id of the binary component that you want to publish | |
// This snippet shows how you can add the item id to the filename. | |
var component = (Component)engine.GetObject(componentUri); | |
var filename = component.BinaryContent.Filename | |
extension = Path.GetExtension(filename); | |
filename = Path.GetFileNameWithoutExtension(filename); | |
filename = String.Concat(filename, "_", componentUri.ItemId.ToString(), extension); | |
engine.AddBinary(component.Id, null, null, component.BinaryContent.GetByteArray(), filename); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TcmTemplateTitle("SuffixBinariesWithId")] | |
public class SuffixBinariesWithId: ITemplate | |
{ | |
public void Transform(Engine engine, Package package) | |
{ | |
string paramMimeTypesToMatch = package.GetValue("mimeTypesToMatch"); | |
// match all image types by default | |
string mimeTypesToMatch = "image/*"; | |
if (!string.IsNullOrWhiteSpace(paramMimeTypesToMatch)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- TemplateBeginRepeat name="Component.Fields" --> | |
@@Field.Name@@ | |
<!-- TemplateBeginRepeat name="Field.Values" --> | |
<!-- TemplateBeginIf cond="Field.ContentType = 'text/plain'" --> | |
@@RenderComponentField(FieldPath, TemplateRepeatIndex)@@ | |
<!-- TemplateEndIf --> | |
<!-- TemplateBeginIf cond="Field.ContentType = 'tridion/field'" --> | |
<!-- TemplateBeginRepeat name="Field.Fields" --> | |
@@Field.Name@@ | |
<!-- TemplateBeginRepeat name="Field.Values" --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- TemplateBeginRepeat name="Component.Fields" --> | |
@@Field.Name@@ | |
<!-- TemplateBeginRepeat name="Field.Values" --> | |
<!-- TemplateBeginIf cond="Field.ContentType = 'text/plain'" --> | |
@@RenderComponentField(FieldPath, TemplateRepeatIndex)@@ | |
<!-- TemplateEndIf --> | |
<!-- TemplateBeginIf cond="Field.ContentType = 'tridion/field'" --> | |
<!-- TemplateBeginRepeat name="Field.Fields" --> | |
@@Field.Name@@ | |
<!-- TemplateBeginRepeat name="Field.Values" --> |
OlderNewer