You can access elements by name like this:
IPage myPage = …;
IPageElement element = myPage[“myElementName”];
If you know the element type and want to access type specific properties/methods, you can just cast it, e.g.
ITextHtml element = (ITextHtml)myPage[“myHtmlTextElement”];
Dr. Jonas Jacobi
Technical Lead
![]()
Mobile Lösungen, Apps und das Internet der Dinge
Ehnernstr. 157
26121 Oldenburg, Germany
Registergericht: Amtsgericht Oldenburg, HRB 209480
Geschäftsführer: Hilmar Bunjes
--
More information about SmartAPI: http://www.smartapi.de
---
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "SmartAPI" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an
smartapi+u...@googlegroups.com.
Wenn Sie in dieser Gruppe einen Beitrag posten möchten, senden Sie eine E-Mail an
smar...@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/d/optout.
Additionally, if you want to get lists of alle elements, you can also access them through
IPage.ContentElements and IPage.LinkElements
Dr. Jonas Jacobi
Technical Lead
![]()
Mobile Lösungen, Apps und das Internet der Dinge
Ehnernstr. 157
26121 Oldenburg, Germany
Registergericht: Amtsgericht Oldenburg, HRB 209480
Geschäftsführer: Hilmar Bunjes
From: smar...@googlegroups.com [mailto:smar...@googlegroups.com]
On Behalf Of suzan...@gmail.com
Sent: Mittwoch, 3. Januar 2018 23:44
To: SmartAPI <smar...@googlegroups.com>
Subject: [SmartAPI] Re: Get Element by element name?
If not - is it possible to get a full list of all elements in a specific page?
On Wednesday, January 3, 2018 at 3:13:51 PM UTC-7,
suzan...@gmail.com wrote:
Is it possible to get the element of page by its name? I was browsing through the SmartAPI library and it doesn't look like there's any methods available for it. Please advise.
--
Hi Suzanne,
you need to fetch the content class object and user that as parameter.
E.g.
IProject project = …;
IContentClass cc1 = Project.ContentClasses.GetByName(“MyCC1”);
IContentClass cc2 = Project.ContentClasses.GetByGuid(…);
IPage newPage1 = project.Pages.Create(cc1);
IPage newPage2 = project.Pages.Create(cc2, “New Headline”);
If you want to, you can also create and connect a page with a single command: project.Pages.CreateAndConnect :
http://www.smartapi.de/smartapi_doc/a00156.html
Cheers
Jonas
IPage newPage1 = project.Pages.Create(cc1);
newPage1.Guid