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
RIteshMRIteshM 

Error: Compile Error: Method does not exist or incorrect signature: ConnectApi.BinaryInput

i write a code in apex for setting the chatter photo of a user . iwrite a function

 

public PageReference setPhoto(){

Http h = new Http();
HttpRequest req = new HttpRequest();
string firstImageURL = 'https://ap1.salesforce.com/resource/1377118388000/sample_pic';
firstImageURL = firstImageURL.replace(' ', '%20');
req.setEndpoint(firstImageURL);
req.setMethod('GET');
req.setHeader('Content-Type', 'image/jpeg');
req.setCompressed(true);
req.setTimeout(60000);
HttpResponse res = null;
res = h.send(req);
blob image = res.getBodyAsBlob();
ConnectApi.BinaryInput bb=ConnectApi.BinaryInput(image, 'image/png','myfile');
System.debug('user is'+ConnectApi.ChatterUsers.setPhoto(null,'00590000001jFln',bb));
return null;

}

 

when i try to save it it is giving me error  

Error: Compile Error: Method does not exist or incorrect signature: ConnectApi.BinaryInput(Blob, String, String) at line 28 column 27

 

 

and i am following this http://www.salesforce.com/us/developer/docs/apexcode/Content/connectAPI_inputs.htm#capi_binary_input 

can you please guideline whether this documentation is wrong or right ?? and how to get ConnectApi.BinaryInput instance

Arun MKArun MK

Hi,

 

Did you check if your API version is 28.0.


If this post is helpful please throw Kudos.
If this post solves your problem kindly mark it as solution.

 

Regards,

Arun

RIteshMRIteshM

Yes my Apex Class Version is 28.0  still i am facing this issue.can u please tell what should be the version of api ??