Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

Uncategorized

Power Platform Analytics

Microsoft recently released new online dashboards to monitor usage and activity with MS “Power” Platform included PowerBI, PowerApps, and MS Flow.   Watch tenant adoption grow with your deployment by leveraging these online reports to demonstrate to IT management the value of the new cloud platform.  Links below.  Cheers! 

shades_smile

Power platform Admin Analytics

Blog > Introducing Power platform Admin Analytics 

FIXED – Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

When coding JavaScript with SP-PNP-JS I came across the error below and wanted to document for others.  Cheers! 

shades_smile

Error

Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

image
image
image

Root Cause

When calling HTTP GET the default Header “accept: application/json” can return data as XML.  

Use F12 Developer Tools to view network traffic with HTTP headers and raw response text.

Solution

Modify JS code to initialize AngularJS with different HTTP headers.

Now SharePoint PNP api calls with Header “accept: application/json; odata=verbose” and returns data as JSON for correct parsing.

$pnp.setup({
	headers: {
		"Accept": "application/json; odata=verbose"
	}
});
image

References

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲