// use this to create the media item
var media = _mediaService.CreateMedia(nodeName, parentFolderId, nodeTypeAlias);
//if you want to specify the key you can like this
media.Key = new Guid("db22bb69-b0ae-44bb-9019-a3e6498d4c25");
_mediaService.Save(media);
Creating media item with IMediaService
I wonder if anyone can point me in the right direction with this.
I'm using IMediaService in v8 as specified here to create a media item, but it fails on the line
with the error
As far as I can tell I've included everything I need to call CreateMedia, any ideas?
thanks
Yes the function syntax is .CreateMedia(string name, int parentId, string mediaTypeAlias, [int userId = 0])
and it looks correct from your method but please can you double check that "id" is not null and is parentId in your createmedia statement.
Hi,
thanks for replying, id is definitely populated with the relevant guid and being passed in where parentId should be - not sure what the issue is.
Instead of GUID - please can you pass int parentID and try as method is accepting integer.
Hi Damion
I hope this helps
Paul
Cheers Paul,
I misunderstood what id I should have been passing in, once I passed the parent folder id it worked fine.
is working on a reply...