Registering Programmatically With the Task Server
To register documents with the Task Server, you submit a task to the Task Server from your program. You submit the task to the MeridianTask object that is instantiated by a Publisher extension for the PowerUser program. That extension is registered as described in Set Up the Task Server. The Task Server executes the task using the options of the publishing job that is specified by the name that you pass to the MeridianTask object. For information about programmatically registering documents without using the Task Server, see Registering Programmatically Without the Task Server.
Using the MeridianTask object requires the following:
- The name of the publishing job that you want to use to publish the documents must be configured in Meridian Enterprise as described in Configure a Publishing Job. For more information about creating and configuring publishing jobs, see Publishing Jobs.
To register documents using the Task Server:
-
Implement programming code that sets at least the JobCode (publishing job name) property of a vault's Task object.
Additional properties may be set, but are not required.
-
Submit the Task object to the BCPublisher.MeridianTask class with the Submit method and pass a Document object as shown in the following examples.
For more information about the MeridianTask object, see MeridianTask Object.
The task can be submitted by any event or command where a Document object exists. For more information about the Submit method, see Document Object Methods.
Note:
In VBScript, you only have access to the selected document; therefore, publishing tasks can only be created for the selected document.
Sub PublishCommand_Execute(Batch)
' Set arguments for the task.
Vault.Task.Set "JobCode", "3BA9DF"
Vault.Task.Set "FeedBackProperty", "Custom.PublishStatus"
' Register the selected document for publishing.
Vault.Task.Submit "BCPublisher.MeridianTask", Document
End Sub
Private Sub btnPublish_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles btnPublish.Click
' Get the selected document to publish.
Dim document As BCDocument = ExtensionHost.CurrentObject
' Set arguments for the task.
Dim task As BCSTask = ExtensionHost.ScriptObjects.Vault.Task
task.Set("JobCode", "3BA9DF")
task.Set("FeedbackProperty", "Custom.PublishStatus")
' Register the document for publishing.
task.Submit("BCPublisher.MeridianTask", document)
End Sub
Private Sub DoIt(ByVal repository As BCRepository)
' Get document to publish.
Dim document As BCDocument = repository.GetFSObject("\MyDocument.doc")
Using taskServer As BCTaskServer = New BCTaskServer(repository.AMServer.AMTaskServerMachine)
' Set arguments for the task.
Dim args As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
args("JobCode") = "3BA9DF"
args("FeedbackProperty") = "Custom.PublishStatus"
' Register the document for publishing.
taskServer.SubmitTask( _
"BCPublisher.MeridianTask", _
args, _
Nothing, _
0, _
document.ID, _
Nothing, _
Nothing, _
Nothing, _
Nothing)
End Using
End Sub
Private Sub DoIt(ByVal repository As BCRepository)
' Get document to publish.
Dim document As BCDocument = repository.GetFSObject("\MyDocument.doc")
Using services As BCServiceProvider = New BCServiceProvider(repository)
Using metadata As BCSMetadata = New BCSMetadata(services)
' Set arguments for the task.
Dim task As BCSTask = metadata.Vault.Task
task.Set("JobCode", "3BA9DF")
task.Set("FeedbackProperty", "Custom.PublishStatus")
' Register the document for publishing.
task.Submit("BCPublisher.MeridianTask", document)
End Using
End Using
End Sub