getting user profile picture using facebook c# sdk from codeplex

前端 未结 5 1215
旧时难觅i
旧时难觅i 2021-01-04 23:25

I am using facebook C# sdk from codeplex and trying to download user\'s profile picture.

I know I can get this from:

http://graph.facebook.com/UID/picture?t

5条回答
  •  感情败类
    2021-01-04 23:58

    You could let the browser get the image for you using the graph api url - graph.facebook.com/UID/picture?type=large or use something like the method below to get the cached url

        public static string GetPictureUrl(string faceBookId)
        {
            WebResponse response = null;
            string pictureUrl = string.Empty;
            try
            {
                WebRequest request = WebRequest.Create(string.Format("https://graph.facebook.com/{0}/picture", faceBookId));
                response = request.GetResponse();
                pictureUrl = response.ResponseUri.ToString();
            }
            catch (Exception ex)
            {
                //? handle
            }
            finally
            {
                if (response != null) response.Close();
            }
            return pictureUrl;
        }
    

提交回复
热议问题