Sunday, April 1, 2012

OrganizationProfile.AddMember throws Attempted to perform an unauthorized operation error

Leave a Comment

Organization Profile is the new feature of SharePoint 2010. This feature is part of SharePoint 2010 server edition.  We had task to create organization profile and add member through timer job. But even after writing down code correctly , Organization Profile.Addmember method throwed "Attempted to perform an unauthorized operation error."

Not much reference was available on web to track down problem. Only one technet forum thread  was closely related to the issue, which gave clue on the problem 

As suggested  in  above forum thread we gave Manage profile permissions to the account but error remained same. I tried luck by giving FULL Control but  error was same.

Timer job executes under the SPTimerV4 service account.  And same user need to have access to the content database.  SPTimerV4 user account was already db owner at content database but still error remain same.

This made me to change the local admin user account  as SPTimerV4 user account and Adding same user account as db owner in content database.. This made OrganizationProfile.Add member code working correctly.
Reference technet forum thread