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

Try our conversational search powered by Generative AI!

How to retrieve not shared properties?

Vote:
 

In Episerver exists shared properties between all languages and can only be edited in the master language.
How to detect if property is shared in C#?

#228540
Sep 29, 2020 6:49
Vote:
 

Hi,

You can check it using the below code

 var contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
            var blockTypeList = contentTypeRepository.List().OfType<PageType>().ToList();
            List<PageType> newlist = new List<PageType>();
            if (blockTypeList != null && blockTypeList.Any())
            {
                
                foreach (var block in blockTypeList)
                {
                    if (block.IsAvailable && string.IsNullOrEmpty(block.Description))
                    {
                        newlist.Add(block);
                        foreach (var prop in block.PropertyDefinitions)
                        {
                            var isLanguageSpecific = prop.LanguageSpecific;

                        }

                    }
                  

                }
            }
#228541
Sep 29, 2020 7:44
Vote:
 

Hi,

I think Ravindra's answer would work if you want to check against a content type for language specific properties but, if you're trying to check whether a specific property on a given contentitem is localisable (for example checking within a controller for a given page), you can look at the Property collection on that content item like this:

currentPage.Property["MyPropertyName"].IsLanguageSpecific
#228583
Sep 30, 2020 8:01
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.