Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Obtain a ContentReference from a string

Vote:
 

Hi

How is it possible to obtain a ContentReference object from an Id in a string?

I need to run the following command:

private IContentRepository _repLoad;
_repLoad = repo; // repo is injected from constructor


IEnumerable children = _repLoad.GetChildren("content link in a string");

Thanks,

#199334
Nov 22, 2018 20:22
Vote:
 

Use ContentReference.Parse("123");

#199338
Nov 22, 2018 23:54
Vote:
 

I would vote for `ContentReference.TryParse()` as this method is not throwing exception in case of junk. I've read on internets that exceptions are bad for your health.

#199353
Nov 23, 2018 8:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.