I need to modify the properties of a media node from whithin a webservice which is written in C#. The folowing code leads to a partial success:
Code:
[WebMethod]
public string MakeComment(string Comment, int MediaID) {
try
{
umbraco.cms.businesslogic.media.Media myMedia = new umbraco.cms.businesslogic.media.Media(MediaID);
myMedia.getProperty("Comments").Value = Comment;
myMedia.Save();
}
catch (Exception e)
{
return e.ToString();
}
return myMedia.getProperty("Comments").Value.ToString();
}
After invoking, the new property value shows up correctly in Umbraco's media manager. However, when I try to access it with an XSLT macro, it still uses the old value. When I click the "Save" button in the manager (without modifying the value manually), the XSLT macro starts using the updated value.
I guess that I have to rebuild some part of Umbraco's cache, but I can't seem to find an appropriate function within the API.
Can anyone point me to the correct solution? :)