Converting a MediaWithCrops file to a byte array inside Umbraco Api Controller
Hello,
I am trying to access a media uploaded on the backoffice via an Umbraco API Controller (because I will call the method from my frontend with Ajax). The media is a .xlsx file that I have to convert to a byte array (I think) in order to browse it and return the data I want to the client.
Here is the start of the method :
public async Task<IList<ProfessionnelRepertoireViewModel>> GetRepertoireDesProfessionnels()
{
var content = _contentQuery.ContentSingleAtXPath("//homePage/espaceAcheteur/repertoireDesProfessionnels");
var repertoireDesProfessionnels = content.Value<MediaWithCrops<File>>("professionalsDirectory");
return new List<ProfessionnelRepertoireViewModel>();
}
I successfully retrieved the file (which is repertoireDesProfessionnels) as a MediaWithCrops<File>. Now, I'm really lost on what to do next. I think I tried everything, IMediaService, MediaFileManager and then some but I can't wrap my head around what I should now.
Converting a MediaWithCrops file to a byte array inside Umbraco Api Controller
Hello,
I am trying to access a media uploaded on the backoffice via an Umbraco API Controller (because I will call the method from my frontend with Ajax). The media is a .xlsx file that I have to convert to a byte array (I think) in order to browse it and return the data I want to the client.
Here is the start of the method :
I successfully retrieved the file (which is repertoireDesProfessionnels) as a
MediaWithCrops<File>
. Now, I'm really lost on what to do next. I think I tried everything, IMediaService, MediaFileManager and then some but I can't wrap my head around what I should now.Thanks for your help!
is working on a reply...