Validate GUID using javascript in SharePoint

There are lot of javascript snippets available to validate the guid string and that requires some number of codes. But SharePoint JSOM provides the single property to validate the GUID format, this will save our time and lines of code.

SP.Guid.isValid(<String>) Used to validate the provided string is guid format and it returns true or false based on the value.

SP.Guid.isValid("72ab1d44-267d-4c9a-8393-7f3cc84e95ef")
//Output:
//true
SP.Guid.isValid("sample-guid-string")
//Output:
//false

SharePoint has lot of options hidden in their massive framework. In this post I am going to bring

Leave a Reply

Your email address will not be published. Required fields are marked *