i write a code in apex for setting the chatter photo of a user . i write 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
You'are trying to use the instance method as a static. Create an instance of ConnectApi.BinaryInput
ConnectApi.BinaryInput binaryInput = new ConnectApi.BinaryInput(fileBlob, null, filename);