sensenet

How to update Custom Fields after File Upload using SenseNet dotnet client


Is there a way I can update my custom fields after a file upload (and having obtained the new content Id) using the sn-client-dotnet?
I am targeting a SN 7 installation.


Solution

  • I think you should reload the content, modify the field and call & await saveAsync()

    var uploadedDocument = await Content.LoadAsync(uploadedDocId);
    uploadedDocument["CustomFieldName"] = someValue;
    await uploadedDocument.SaveAsync();
    

    You can find some detailed examples here