Please login to access all of the features of the Community Site.

UpdatePersonProfilePhoto

M v5.0

This command is used to update the profile photo of either the CurrentPerson, or if a PersonGuid is supplied as the parameter, it will update theirs. Options are shown with the ShowActionPanel command, including uploading an existing photo or capturing a new one.

Important

M20.0
Use this command for any person photo upload. It is what notifies the rest of the app, so every Avatar showing that person refreshes on its own. Uploading through a different path saves the photo but leaves those avatars showing the old picture, with no error to indicate why. This command works on Person records only.

Warning

This command requires Edit permissions on the following API endpoint:
POST api/People/UpdatePersonProfilePhoto?personGuid={personGuid}&filename={filename}

Starting with Core v16, the role of 'RSR - Mobile Application Users' should be given permission. Previous versions should remain using the role of 'All Authenticated Users'.

<Button Text="Update Photo"
    Command="{Binding UpdatePersonProfilePhoto}"
    CommandParameter="8fedc6ee-8630-41ed-9fc5-c7157fd1eaa4" />

The action panel options shown with this command

There are some additional command parameters that can be used for extended functionality. These are UpdatePersonProfilePhotoCommandParameters.

Properties

PropertyTypeDescription
PersonGuidGuidThe Guid of the Person to update the profile photo for.
ImageImage  An Image control to update the source of immediately when the new photo is uploaded. Not required for Rock:Avatar, which refreshes itself. Useful for giving the block that owns the upload instant feedback, or for updating a plain Rock:Image.  

Here's an example for using the Image property:

<Rock:Image Source="image.png"
    x:Name="PersonImage" />

<Button Text="Update Photo"
    Command="{Binding UpdatePersonProfilePhoto}">
    <Button.CommandParameter>
        <Rock:UpdatePersonProfilePhotoCommandParameters Image="{x:Reference Name=PersonImage}" />
    </Button.CommandParameter>
</Button>