7

Could I request the broker server for a component sending the component's URI, using dd4t?

When I use ComponentFactory.TryGetComponent - it returns null for the object.

Using Tridion2011sp1 and DD4T 1.25

Thanks in advance.

7
IComponent ComponentFactory.GetComponent(string componentUri, string templateUri = "");

or

bool ComponentFactory.TryGetComponent(string componentUri, out IComponent component, string templateUri = "");

are the correct methods. If you are getting null, have you verified that the component presentation you're requesting is in the Broker DB, i.e. is published?

  • 1
    Nick is mentioning it already, but it's important to remember that you cannot request components. Under the hood it requests a ComponentPresentation and returns the component from that CP. This means that the ComponentPresentation should be published as a DCP to the broker. – Albert Romkes Jun 3 '13 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.