PHP Automation Client

How can I set following two properties (which might be multiple value properties) dc:subjects and dc:contributors. I can set all the other properites by passing their values as string using following method… $answer = $session->newRequest(“Document.SetProperty”)->set('input', 'doc:' . $path)->set('params', 'value', $value)->set('params', 'xpath', $xpath)->sendRequest();

where $xpath is property name such as dc:title and $value is string like 'My First File'.

0 votes

3 answers

2577 views

ANSWER



To set multiple properties on a Document, you can use the Document.Update operation.

See the documentation here.

To set multi valued property, separate the values with ,:

dc:subjects=arts/architecture,arts/cinema

2 votes



here the sample use case you need I think. in one properties string you can set multiple params (separated with \n) taking multiple values (separated with ,) be aware to use double quotes so the \n character is understand properly.

$session->newRequest("Document.Update")
        ->set('input', 'doc:' . $inputDocPath)
        ->set('params', 'properties', "dc:title=The Document Title\ndc:description=foo bar\ndc:subjects=arts/architecture,arts/cinema")
        ->sendRequest();
0 votes



Hi There,

I already tried doing it that way but that doesn't work. Please look at the code below…

/ This line creates a blank document / $answer = $session->newRequest(“Document.Create”) ->set('input', 'doc:' . $filePath) ->set('params', 'type', $type) ->set('params', 'name', $name) ->sendRequest();

/ This line retrieves the path of the document / $path = $answer->getDocument(0)->getPath();

/ This line works fine and sets up the property (ie dc:description) without any trouble / $answer = $session->newRequest(“Document.SetProperty”)->set('input', 'doc:' . $path)->set('params','xpath',“dc:description”)->set('params','value',“This is the description of file”)->sendRequest();

/ This line fires Error Server message when executed and doesn't set the property dc:subjects at all / $answer = $session->newRequest(“Document.SetProperty”)->set('input', 'doc:' . $path)->set('params','xpath',“dc:subjects”)->set('params','value',“arts/architecture,arts/cinema”)->sendRequest();

So basically I need to know how I can set the property using PHP Automation Client. There must be a different syntax to set up multi-value property for the PHP Automation Client.

Secondly, I also tried using Document.Update automation request as per the example (using PHP Automation Client) but that didn't work.

So basically I need PHP Automation Client Examples for setting up multiple properties and multi-value properties.

0 votes