Found a solution. Turns out instead of getting it via Umbraco.Media (which gets a content object) you have to use the media service and use a get call call there.
//DELETE OLD FILE
string OldIMGId = memb.MemberProperties.Find(x => x.Alias == "profilePic").Value.ToString();
///todo:Get delete media working or leave it alone? Maybe have a function that runs once every now and then and cleans up the db.
if (OldIMGId != null && OldIMGId != "")
{
var temp = _mediaService.GetById(int.Parse(OldIMGId));
if(temp!=null)
_mediaService.Delete(temp);
}
Cannot delete media node
I am trying to delete a media node (if found).
I am not sure why it is not deleting this.
Does anyone know why this is not being removed?
Found a solution. Turns out instead of getting it via Umbraco.Media (which gets a content object) you have to use the media service and use a get call call there.
is working on a reply...