2013-08-21 58 views
0

我在apex中編寫代碼以設置用戶的聊天照片。我寫一個函數錯誤:編譯錯誤:方法不存在或簽名不正確:ConnectApi.BinaryInput

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實例

回答

0

您試圖將實例方法用作靜態方法。創建一個實例ConnectApi.BinaryInput

ConnectApi.BinaryInput binaryInput = new ConnectApi.BinaryInput(fileBlob, null, filename); 
相關問題