The idea is that a user on a project subsite will be able to execute the script and do a couple of housekeeping actions. The script file is referenced via a Script Editor web part on a page in the subsite. The first step is to retrieve the current subsite context for things like the subsite title and the subsite url. To make the script usable for all subsites I'm doing this via:
var subsiteCtx = new SP.ClientContext.get_current(); var subWeb = subsiteCtx.get_web(); subsiteCtx.load(subWeb); subsiteCtx.executeQueryAsync( *callbackfunction*,*callbackfunction*)
When I execute this code I'm receiving:
Error: Sys.ArgumentException: Value does not fall within the expected range. Parameter name: serverRelativeUrlOrFullUrl
I originally thought this was because I'm executing a script from a file hosted on the top level site but the error persists whether I host the script file on the subsite or paste the code directly in to the script editor web part. When I run the exact same code manually in the browser console I get the desired behavior. What the heck is going on?