我在 apex 中编写了一个代码来设置用户的喋喋不休的照片。我写了一个函数
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;
}
当我尝试保存它时,它给了我错误
Error: Compile Error: Method does not exist or incorrect signature: ConnectApi.BinaryInput(Blob, String, String) at line 28 column 27
我正在关注这个http://www.salesforce.com/us/developer/docs/apexcode/Content/connectAPI_inputs.htm#capi_binary_input 你能指导一下这个文档是对还是错吗?以及如何获取 ConnectApi.BinaryInput 实例