Error: Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.
I saw many people has came across this is error when updating user profile property values, but I couldnt find a solid solution to this issue. So thought of posting a article on this one. The error may be misleading. Many think web.AllowUnsafeUpdates=true will solve the issue. But it wouldn't because this update will not have any impact on the User Profile Service application.
Try the below code, it should solve the issue.
The difference here is SPContext.Current.Web.AllowUnsafeUpdates=true will update the current user profile to allow updates. Also make sure that there is no context given when Instantiating UserProfileManager object as it gets populated automatically when run on a personal site context.
I saw many people has came across this is error when updating user profile property values, but I couldnt find a solid solution to this issue. So thought of posting a article on this one. The error may be misleading. Many think web.AllowUnsafeUpdates=true will solve the issue. But it wouldn't because this update will not have any impact on the User Profile Service application.
Try the below code, it should solve the issue.
The difference here is SPContext.Current.Web.AllowUnsafeUpdates=true will update the current user profile to allow updates. Also make sure that there is no context given when Instantiating UserProfileManager object as it gets populated automatically when run on a personal site context.