Last active
January 2, 2016 00:39
-
-
Save chrismrgn/8225441 to your computer and use it in GitHub Desktop.
SDL Translation Manager API - Create Job
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
public void Translate(string identifiableObjectId, string owningRepositoryId) | |
{ | |
if (!string.IsNullOrWhiteSpace(identifiableObjectId) && !string.IsNullOrWhiteSpace(owningRepositoryId)) | |
{ | |
//Create instance of TranslationJobManager | |
TranslationJobManager jobManager = new TranslationJobManager("DOMAIN\\USER"); | |
//Create a PUSH job (job created at the source publication) | |
TranslationJob translationJob = jobManager.CreateJob("JobName", owningRepositoryId, TranslationJobType.PushJob); | |
//Get all target publications, based on the source publication | |
var targetPublications = jobManager.GetTranslationConfiguration(new Tridion.TranslationManager.DomainModel.Api.TcmUri(owningRepositoryId)); | |
foreach (var targetconfiguration in targetPublications.TargetConfigurations) | |
{ | |
translationJob.TargetPublicationUris.Add(targetconfiguration.ConfiguredItemUri); | |
} | |
//Add the item(s) to the translation job | |
translationJob.AddedItems.Add(new AddedItem(identifiableObjectId)); | |
//Set the translation job's initial state | |
translationJob.State = TranslationJobState.ReadyForTranslation; | |
//Save job | |
translationJob.Save(); | |
} | |
else | |
{ | |
//invalid arguments | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment