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
I have DAMP property on my doctype the data is stored as xml. How do I go about adding an existing image in the media section the document using Umbraco api?
There aren't any real samples for this, but there might be some usefull things in the source code.
In DigibizAdvancedMediaPicker.ascx.cs there is method called GetXML() and GetMediaElements(string id). These are the methods which will store the selected images as media xml.
In DAMP_ApplicationBase.cs there is a method called UpdateDAMP(Media media, bool deleteMediaItem). This method makes sure if you update an image in the media section it also gets updated on the documents which store the media xml.
So hopefully you can use this code to add an existing image.
Cool many thanks. Just interested in first suggestion as I am looking to create a fieldadaptor for cmsimport and the document type has DAMP field, so will have a play with your suggestion
Just a quick note. The GetMediaElements(string id) method from my first suggestion has changed since DAMP 1.0. First I used library.GetMedia, but I changed it in DAMP 2.0 because I had some problems:
So in DAMP 2.0 I get the xml directly from the cmsContentXml table which solved it. If you want to create a fieldadaptor I suggest you use the code from DAMP 2.0, but I just wanted to let you know that DAMP 1.0 is different.
Did you succeeded in creating a fieldadaptor for cmsimport using my samples?
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted