2011-03-10 129 views
2

我正在使用SocialCommentManager.GetComments方法獲取社交評論數組,我需要獲取該評論的個人資料圖片,但無法找到去做吧。如何獲取Sharepoint的個人資料圖片SocialComment.Owner

我如何檢索意見的一些示例代碼:

 SocialComment[] comments = mySocialCommentManager.GetComments(CurrentPage.Uri); //ToDo: Update parameters to allow paging 

     foreach (SocialComment comment in comments) 
     { 
      //ToDo: Get comment.Owner profile pricture somehow 

任何幫助,非常感謝

回答

3

comment.Owner包含類型的值「用戶配置」。 UserProfile的圖片存儲在「PictureURL」字段中。所以你的代碼是這樣的:

foreach (SocialComment comment in comments) 
{ 
    UserProfile up = comment.Owner; 
    if (up["PictureURL"] != null && up["PictureURL"].Value != null && !String.IsNullOrEmpty(up["PictureURL"].Value.ToString())) 
    { 
    string pictureUrl = up["PictureURL"].Value.ToString(); 
    } else { 
    //picture is not defined 
    } 
} 

我希望它有幫助。

感謝,

德米特里 - pdfsharepoint.com

相關問題