This is how i do it:
First i get a download ticket (you can alo use DocumentService.CheckoutFile
ByteArray ticket = documentService.GetDownloadTicketsByFileIds(new long[] { selectedFile.Id }).First();
Use the ticket to find the properties
CtntSrcPropDef[] fileProps = Globals.Connection.WebServiceManager.FilestoreService.GetContentSourcePropertyDefinitions(
ticket.Bytes, true);
Then i create PropWriteRequests
PropWriteRequests propWriteRequests = new PropWriteRequests();
List<PropWriteReq> requests = new List<PropWriteReq>()
{
new PropWriteReq()
{
CanCreate = true,
Moniker = "VltCategory!{D5CDD505-2E9C-101B-9397-08002B2CF9AE}!nvarchar", // Moniker van VltCategory property
Val = selectedFile.Cat.CatName
}
};
propWriteRequests.Requests = requests.ToArray();
Then i use CopyFile and include the propWriteRequest
PropWriteResults propWriteResults = new PropWriteResults();
byte[] uploadTicket = filestoreService.CopyFile(ticket.Bytes, extension, true, propWriteRequests, out propWriteResults);
And now use DocumentService.AddUploadedFile to upload the file with the new properties.
If you used CheckOut on step one can just check the file in.
File newFile = documentService.AddUploadedFile(targetFolderId, tempFileName, "Temporary copy design for Flatten command", selectedFile.ModDate, null, bom, selectedFile.FileClass, false, uploadByteArray);
More information can be found here:
https://justonesandzeros.typepad.com/blog/2015/02/another-way-to-update-properties.html
Good luck