AI OnAI Off
Hello Quan,
No am not running in schedule job context. I am calling profile store api and using site id as one of the parameter from website itself (since my applicaiton has multi site) to filter site content accordingly.
This seems to be working fine while in local but in DXP it always gives me empty GUID
When you run following code, does it gives you list of Sites?
var siteDefinitionRepository = context.Locate.Advanced.GetInstance<ISiteDefinitionRepository>();
var siteDefinitions = siteDefinitionRepository.List();
Here's the code I use in DXP environment to get the siteId and do something with it. However we only have one site, you may need to change ContentReference.StartPage accordingly if you have multiple sites.
public void Initialize(InitializationEngine context) { var resolver = context.Locate.Advanced.GetInstance<ISiteDefinitionResolver>(); var site = resolver.GetByContent(ContentReference.StartPage, fallbackToWildcard: true, fallbackToEmpty: false); var siteId = site.Id;
//Your logic here }
Hello,
When i do Sitedefinition.current.id , I get value when running in local while the same thing resolves to empty guid when deployed in DXP. Why would that be ?