When working with client APIs such as JSOM or REST you have probably noticed that certain properties of objects are not available compared to SSOM counterparts. For example, SPList class exposes SPList.Author property for getting an SPUser object that represents information about the user who created the list which in turn is not available for SP.List object. Hence the question arises, how those properties could be retrieved using client APIs?
The solution that I would like to demonstrate is based on retrieving client object properties from XML schema.
Getting SP.List object properties using JSOM
The function getListProperties is indented for loading list schema of the SP.List using SP.List.schemaXml property and extracting properties from it’s value:
The following example demonstrates how to retrieve Author property using the specified method:
Getting SP.List object properties using REST
The following REST endpoint is used for retrieving SP.List.schemaXml property:
The same example that demonstrates how to retrieve Author property of List resource using REST: