Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello,
I have a doctype that has multiple media picker, I am creating content of this type using content service and then looking to set the multiple media picker field code looks like
portfolio.SetValue(Helpers.DocTypeConstants.Portfolio.Images,packageItem.MediaIds);
where MediaIds is List of ints, my question is will that work or do i need to give the value as csv string list or??
Regards
Ismail
Hi Ismail,
You will have to convert to CSV, something like this:
portfolio.SetValue(Helpers.DocTypeConstants.Portfolio.Images,String.Join(",", packageItem.MediaIds.Select(x => x.ToString()).ToArray()));
Jeavon
If anyone is having trouble with Umbraco 8 then this is how I do it.
You basically need to get the UDI of the media item and use this to pass into the media picker field.
if you are dealing with a multiple media picker from memory I believe it is a comma separated list of Udis.
var content = _contentService.GetById("content-node-id-here"); if (content != null) { content.SetValue("basicStringValue", "some-string-content"); content.SetValue("anotherBasicStringValue", "some-string-content"); IMedia media = _mediaService.GetById(mediaId); if(media != null) { content.SetValue("logo", media.GetUdi()); } if(image != null) _contentService.SaveAndPublish(content); }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
SetValue with Multiple Media picker
Hello,
I have a doctype that has multiple media picker, I am creating content of this type using content service and then looking to set the multiple media picker field code looks like
where MediaIds is List of ints, my question is will that work or do i need to give the value as csv string list or??
Regards
Ismail
Hi Ismail,
You will have to convert to CSV, something like this:
Jeavon
If anyone is having trouble with Umbraco 8 then this is how I do it.
You basically need to get the UDI of the media item and use this to pass into the media picker field.
if you are dealing with a multiple media picker from memory I believe it is a comma separated list of Udis.
is working on a reply...