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.

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.
[code lang=”js”]
SP.Guid.isValid("72ab1d44-267d-4c9a-8393-7f3cc84e95ef")
//Output:
//true
[/code]
[code lang=”js”]
SP.Guid.isValid("sample-guid-string")
//Output:
//false
[/code]

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

Shantha Kumar
Shantha Kumar
Articles: 280