function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

sforce.connection.query returns InvalidType for CollaborationGroupMember object

Super simple page, but when I run it I get an exception, "sObject type 'CollaborationGroupMember' is not supported."  I'm able to query other objects, and Googling around I haven't found an explanation why--or I'm Googling the wrong terms.

However, this link might suggest such a query from VF just isn't possible.
<apex:page >
	<apex:includescript value="/soap/ajax/33.0/connection.js" />
	<apex:includescript value="/soap/ajax/33.0/apex.js" />
		try { 
			var query = "select collaborationGroupId, from CollaborationGroupMember where memberid = '{!$User.ID}'"
			//var query = "select id from account";
			//sforce.connection.sessionId = "{!$Api.Session_ID}";
			var records = sforce.connection.query(query); 
		catch(e) { 

I got it working with a controller, but it still doesn't answer the question, "Why can't I use sforce.connection.query() against CollaborationGroupMember?"

The new page:
<apex:page controller="MyGroupsFB03186Controller" >
	<apex:repeat value="{!myChatterGroups}" var="each" >
		<apex:outputLink value="/{!each.collaborationGroupId}">{!}</apex:outputLink><br />

The new controller:
public with sharing class MyGroupsFB03186Controller extends XedeController {
	public MyGroupsFB03186Controller() {
		myChatterGroups = [
			select	collaborationGroupId, 
			  from	CollaborationGroupMember
			 where	memberid = :UserInfo.GetUserId()

	public list<CollaborationGroupMember> myChatterGroups { get; private set; }

I recently encountered this error. Certain users could successfully query against ApexPage, while others received the "not supported" error. Enabling the "View Setup and Configuration" permission on the affected User's Profile would prevent this error, but there is obviously more to consider before regarding this as a solution.