Hi,
you are looking for
PageElementFactory.Instance.CreateElement
http://www.smartapi.de/smartapi_doc/a00253.html#ad37a665258f62ee68a8a97043ff2dd4e
You then need to cast the return value to the appropriate element type.
Hope this helps
Jonas
var getElement = erminas.SmartAPI.CMS.Project.Pages.Elements.PageElementFactory.Instance.CreateElement(selectedProject, elementGuid, languageVariant);
The element type I am targeting is TextHTML.
--
var element = (ITextHtml)erminas.SmartAPI.CMS.Project.Pages.Elements.PageElementFactory.Instance.CreateElement(selectedProject,
elementGuid, languageVariant); //you could also cast to IText as Hilmar said. It's a super class of ITextHtml
element.Value = "<p>my new text</p>";
element.Commit();
Cheers
Jonas
|
Severity |
Code |
Description |
|
|
|
|
|
Error |
CS1061 |
'IPageElement' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'IPageElement' could be found (are you missing a using directive or an assembly reference?) |
|
|
|
|
|
Error |
CS1061 |
'IPageElement' does not contain a definition for 'Commit' and no extension method 'Commit' accepting a first argument of type 'IPageElement' could be found (are you missing a using directive or an assembly reference?) |
|
|
|
|
|
Severity |
Code |
Description |
|
|
|
|
|
Error |
CS0246 |
The type or namespace name 'ITextHtml' could not be found (are you missing a using directive or an assembly reference?) |
|
|
|
|
|
Severity |
Code |
Description |
|
|
|
|
|
Error |
CS1061 |
'ITextHtml' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'ITextHtml' could be found (are you missing a using directive or an assembly reference?) |
|
|
|
|
|
Error |
CS1061 |
'ITextHtml' does not contain a definition for 'Commit' and no extension method 'Commit' accepting a first argument of type 'ITextHtml' could be found (are you missing a using directive or an assembly reference?) |
|
|
|
|