London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

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.