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

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 = '';
firstImageURL = firstImageURL.replace(' ', '%20');
req.setHeader('Content-Type', 'image/jpeg');
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 

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

Arun MKArun MK



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.





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 ??