cancel
Showing results for 
Search instead for 
Did you mean: 

Updating many properties with the PHP client

Megha_
Champ on-the-rise
Champ on-the-rise

Another query, as we're moving documents from one system to another, we need to set up lots of metadatas when a document gets uploaded/updated. According to the PHP Automation client, I believe I can set a single property (such as dc:title or dc:description) at a time by running following command...

$answer = $session->newRequest("Document.SetProperty")->set('input', 'doc:' . $path)->set('params', 'value', "New Title")->set('params', 'xpath', "dc:title")->sendRequest();

But the problem is that I need to run above command for every single property. So if I'm setting up 8 different properties for a document, I need to run the above command 8 times.

Is it possible to pass an associative array that sets up all the necessary properties in one go?

2 REPLIES 2

Guian_
Confirmed Champ
Confirmed Champ

I belive that's what the 'Document.Update' request is for :

$session->newRequest("Document.Update") ->set('input', 'doc:' . $newPath) ->set('params', 'properties', "dc:title=The Document Title dc:description=foo bar") ->sendRequest();

in this example it set the title and the description at once. ( note that the new line between the two properties is important )

Guian_
Confirmed Champ
Confirmed Champ

LOL -> the forum doesn't show new lines so you don't see it, but there should be one 😉