Display ContentGuid

Vote:
 

Hi,

I would like to show contentguid field along with other fields (ID, Name, Languages and Visible to) on blocktype editorial screen.

When i import and export the contents from one environment to another environment, the content ID has changed but content guid remains same across both the environments. 

Could someone please guide me to know if there is anyway contentguid can be added on the editorial screen along with other fields ? is there any specific reason for having content ID same and guid different during import and export from one to another environment  ?

Thanks & Regards,

Suresh

#189196
Mar 13, 2018 12:36
Vote:
 

Hi, to answer the first part content ID and content GUID.

Content ID is not unique between systems. If you create two pages in your development environment you can notice that the content ID is sequential. First page content ID might be 150 and second 151. So the content ID most likely would clash between systems.

Content GUID on the other hand is "globally unique identifier" so it will not clash between systems (https://blogs.msdn.microsoft.com/oldnewthing/20080627-00/?p=21823).

#189223
Mar 13, 2018 18:08
Vote:
 

Thanks for the response.

I would like to show contentguid for editors on a block editorial screen.  content fields like ID, Name, Languages and Visible to are displaying by default for editors. if i want to show contentguid, what's the besy way to display contentguid like other fields ?

#189289
Mar 14, 2018 15:55
Vote:
 

Hey, Suresh
Were you ever able to figure this out?

I need to show the GUID too.

Thanks,
Kris

#222710
May 11, 2020 19:27
Vote:
 

Hi, 

I was able to do this by using SetDefaultValues() like this: 

        public override void SetDefaultValues(ContentType contentType)
        {
            base.SetDefaultValues(contentType);
            UniqueId = ContentGuid.ToString();
        }

and on the content type I have a property UniqueId:

        [Display(GroupName = Global.GroupNames.Content, Order = 0)]
        [Editable(false)]
        public virtual string UniqueId { get; set; }

Only downside is that this will set it only when creating a new content, but you can propably write a scheduled job or something to update UniqueId on existing content items if needed.

#224799
Jun 26, 2020 7:24
* 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.