We had a requirement where a user profile property will be updated from the event receiver of a custom list. The user profile property which we can had “user can override” and “Allow users to edit”, however we were getting an error “Attempted to perform an unauthorized operation”
The code was running under RunWithElevated delegate. We traced the user id which was Sharepoint\System. The system account in use will be the App pool Identity under which the current Sharepoint site is running. We took app pool identity id and gave full permission for user profile service application. This didn’t solve our problem.
Get the App pool identity, of the Sharepoint site from IIS.
Go to Sharepoint Central Admin > Application Management > Manage Service Application.
Select the User Profile Service Application which is associated to your site, and select Manage Permission from top ribbon. Add the App Pool Id and give full control.
Then select Administrators in the TOP ribbon for User Profile service application and add the app pool identity id and give full control.