This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Component comp = Engine.GetObject("tcm:6-4267") as Component; | |
// retrieve the itemfields | |
var fields = comp.Fields(); | |
// retrieve the meta itemsfields | |
var metaFields = comp.MetaFields(); | |
// to retrieve a component that is added to "comp" as a component link: | |
Component comp = fields.Component("LinkedComponent"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = Wrapper.GetCoreServiceWsHttpInstance(cmsurl, username, password, domain, CoreServiceInstance.Tridion2011); | |
Console.WriteLine(client.GetApiVersion()); | |
// retrieve a component linked from a component | |
ComponentData comp = "tcm:5-18".ToTcmUri().GetItem<ComponentData>().GetFieldAsComponent("linkedComponent"); | |
//retrieve a xml representation list of the items within the forlder and its childern | |
XElement el = "tcm:5-55-2".ToTcmUri().GetListXml(true); | |
// retrieve field as string from the content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DD4T.ContentModel.Contracts.Logging; | |
using System; | |
using System.Collections.Generic; | |
using System.Web.Http; | |
namespace MyDD4T.RestService | |
{ | |
[RoutePrefix("mycustom")] | |
public class MyCustomController : ApiController | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Owin; | |
using Owin; | |
using DD4T.RestService.WebApi; | |
using Autofac; | |
using Autofac.Integration.WebApi; | |
[assembly: OwinStartup(typeof(MyDD4T.RestService.Startup))] | |
namespace MyDD4T.RestService | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
using Microsoft.Owin; | |
using Owin; | |
using DD4T.RestService.WebApi; | |
using Autofac; | |
using Autofac.Integration.WebApi; | |
using DD4T.ContentModel.Contracts.Logging; | |
using Microsoft.Owin.Security.Cookies; | |
using Microsoft.Owin.Security; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HttpClientAuthentication : DD4T.Providers.Rest.IHttpMessageHandlerFactory | |
{ | |
public HttpMessageHandler CreatePipeline(HttpMessageHandler innerHandler) | |
{ | |
return HttpClientFactory.CreatePipeline(innerHandler, new[] { | |
new BasicAuthenticationHandler() | |
}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ILifetimeScope BuildContainer() | |
{ | |
var builder = new ContainerBuilder(); | |
builder.RegisterType<HttpClientAuthentication>() | |
.As<DD4T.Providers.Rest.IHttpMessageHandlerFactory>(); | |
builder.UseDD4T(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
routes.MapRoute( | |
name: "TridionPage", | |
url: "{*PageUrl}", | |
defaults: new { controller = "Page", action = "Page" } | |
); | |
routes.MapRoute( | |
name: "Default", | |
url: "{controller}/{action}/{id}", | |
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MvcApplication : System.Web.HttpApplication | |
{ | |
ILifetimeScope BuildContainer() | |
{ | |
var builder = new ContainerBuilder(); | |
builder.RegisterControllers(typeof(MvcApplication).Assembly); | |
builder.UseDD4T(); | |
return builder.Build(); | |
} | |
protected void Application_Start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PageController : TridionControllerBase | |
{ | |
public PageController(IPageFactory pageFactor, | |
IComponentPresentationFactory componentPresentationFactory, | |
ILogger logger, | |
IDD4TConfiguration configuration) : | |
base(pageFactor, componentPresentationFactory, logger, configuration) | |
{ | |
public override ActionResult Page(string url) |
OlderNewer