Changing the Group Owner via CSOM

There are many things that cannot be done purely using REST.  A lot of these just fall into the category of, "we haven't gotten around to that yet" type of issues.  Once of my UK friends asked me how to change the owner of a SHarePoint group…after using my SP REST tool, I realized you can't do it using REST, so you have to fall back to CSOM XML:

POST http://weburl/_vti_bin/client.svc/ProcessQuery HTTP/1.1
X-RequestDigest: 0xAE382F0A8F11688BA9BE66739F84443892CE5E5452BA3E2622F6013D9D97EA8A8D9476463EDC503F700EB24F45024150D0DEEB2F40B160CD88BA7C7B4769BECD,15 Jan 2014 00:11:02 -0000
Content-Type: text/xml
Host: www.sanspug.org
Cookie: FedAuth=blah
Content-Length: 612
Expect: 100-continue
Accept-Encoding: gzip, deflate
 
XML body is:
 
<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
<Actions>
<SetProperty Id="45" ObjectPathId="32" Name="Owner">
<Parameter ObjectPathId="33" />
</SetProperty>
<Method Name="Update" Id="46" ObjectPathId="32" />
</Actions>
<ObjectPaths>
<Identity Id="32" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:a1452dcc-8fc4-4631-8ada-97cb204810f1:g:9" />
<Identity Id="33" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:a1452dcc-8fc4-4631-8ada-97cb204810f1:g:7" />
</ObjectPaths></Request>

 
The ids are randomly generated and can be anything you want, as long as they correlate (setproperty and method objectpathid is the object you are updating).  The most important part is the “Name” parts. The first part is the typeid of the object (in this case is means SPGroup), the second part as you can see if the site guid id.  The response does in fact return json if you tell it too:
 
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
X-SharePointHealthScore: 0
SPClientServiceRequestDuration: 40
X-AspNet-Version: 4.0.30319
SPRequestGuid: 98566a9c-5966-00b0-677e-ad44fd7f45fd
request-id: 98566a9c-5966-00b0-677e-ad44fd7f45fd
X-RequestDigest: 0x25DCBE0BB97677EE737DD5C78AAD2E3E0F468648C3C7E3D0629AE239D44B71ADBFBA553529AE63F97FF0DF5480B63E79F901ADB65BB9CA7EF0B227293B53EB37,15 Jan 2014 00:11:04 -0000
X-FRAME-OPTIONS: SAMEORIGIN
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 15.0.0.4420
X-Content-Type-Options: nosniff
X-MS-InvokeApp: 1; RequireReadOnly
Date: Wed, 15 Jan 2014 00:11:04 GMT
Content-Length: 145
 
[
{
"SchemaVersion":"15.0.0.0","LibraryVersion":"15.0.4525.1000","ErrorInfo":null,"TraceCorrelationId":"98566a9c-5966-00b0-677e-ad44fd7f45fd"
}
]