10. Dezember 2021

· Whitepaper

GetCentralSections

Inhaltsverzeichnis

xx Kapitel

Auslesen vorhandener zentraler Inhalte

RequestParameter: CentralSectionRequest
ResponseParameter: CentralSectionResponse

Mit Hilfe dieser Methode können Sie die vorhandenen zentralen Inhalte einer Newslettervorlage auslesen.

Das Request-Objekt besitzt folgende Felder zur Steuerung der Abfrage:

Template Die Vorlage für welche die zentralen Inhalte abgefragt werden.

Das Response-Objekt enthält eine Liste von Sections.

GetCentralSections

Beispiel Request „Auslesen zentrale Inhalte“

C#

//Create an instance of the service agent 
ServiceAgent agent = new ServiceAgent(); 
TemplateRequest request = new TemplateRequest(); 
request.SecurityContext = GetSecurityContext(); 

//Get the templates from mailworx 
TemplateResponse response = agent.GetTemplates(request);

	CentralSectionRequest request = CentralSectionRequest(); 
	request.SecurityContext = GetSecurityContext(); 
	request.Template = templateResponse.Templates[0]; 
	
	//Get the central sections of the template CentralSectionResponse 
	response = agent.GetCentralSections(request); 
	foreach(SectionDefinition secDef in response.SectionDefinitions){ 
	Console.WriteLine(SectionDefinition {0}(Guid={1}, IsSingleton={2}),secDef.Name,secDef.Guid,secDef.IsSingleton); 
		foreach (Section sec in response.Sections) { 
			Console.WriteLine({0} ({1})sec.StatisticName, sec.Guid); 
		} 
		Console.WriteLine(); 
	}