Getting/Displaying User's Avatar via API

Latest post Mon, May 19 2008 12:24 PM by mattb. 2 replies.
  • Fri, May 16 2008 10:14 PM

    • mattb
    • Not Ranked
    • Joined on Tue, Feb 8 2005
    • Woodbury, MN
    • Posts 25
    • Points 245

    Getting/Displaying User's Avatar via API

    This code:

    public static string GetUserAvatar(string UserName)
    {
    MembershipService
    service = new MembershipService("MySiteURL", "Me", "MyKey");
    return service.GetUser(UserName).AvatarUrl;
    }

    Run with my name returns this:  http://community.mysite.com/api/membership.ashx/users/2100/avatar

    How do I use that to get the path to the file so I can display in my image tag?

     

     

    http://community.metalreview.com/forums

    • Post Points: 20
  • Mon, May 19 2008 11:55 AM In reply to

    Re: Getting/Displaying User's Avatar via API

    Reply |Contact |Answer

    There is currently an issue with the avatar handling that will be fixed in SP1.  The avatar support was added to the REST API before the avatars were moved into the new CFS storage framework, and the REST API wasn't updated to the new method.

    If you go to the URL returned by AvatarUrl, it will return a 301 redirect to the actual avatar URL (though the URL that it returns is where the issue is).  In the SP1 client API, we will have a method on the MembershipService for getting the attachments that you'd be able to use.

    • Post Points: 20
  • Mon, May 19 2008 12:24 PM In reply to

    • mattb
    • Not Ranked
    • Joined on Tue, Feb 8 2005
    • Woodbury, MN
    • Posts 25
    • Points 245

    Re: Getting/Displaying User's Avatar via API

     Ahhh... ok, thanks.

    http://community.metalreview.com/forums

    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com