I have created a media item in code and see it show up under the umbraco media section. At the same time I am trying to create a document and assign one of it's properties to the newly created media. For example:
The newly created media object is "m". The documenttype property is "guestbookImage" which is a media type. When I try to create a document every other property is populated except for the media type. I am not sure what to assign to this property? I have tried:
doc.getProperty("guestbookImage").Value = m
doc.getProperty("guestbookImage").Value = m.Id
Neither one seems to populate it? Is there a property of the media class I should be using? Any help or examples would be appreciated. Thanks.
I was working with python and foolishly had the code indented where it shouldn't have been.. Used to C# hehe. Ah well. Sorry if I wasted anyone's time.
how to assign media to document in api?
I have created a media item in code and see it show up under the umbraco media section. At the same time I am trying to create a document and assign one of it's properties to the newly created media. For example:
The newly created media object is "m". The documenttype property is "guestbookImage" which is a media type. When I try to create a document every other property is populated except for the media type. I am not sure what to assign to this property? I have tried:
doc.getProperty("guestbookImage").Value = m
doc.getProperty("guestbookImage").Value = m.Id
Neither one seems to populate it? Is there a property of the media class I should be using? Any help or examples would be appreciated. Thanks.
Using m.Id (media Id parameter) works.
I was working with python and foolishly had the code indented where it shouldn't have been.. Used to C# hehe. Ah well. Sorry if I wasted anyone's time.
is working on a reply...