Welcome to my personal blog, All the information in this bogs is my ideas,findings and thoughts on .Net, Asp.Net and SharePoint.
ALL POSTING ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND
A work-around to this issue is, execute the code under admin privileges(impersonate the user), you can either follow the Win API impersonation or using the SPSecurity.RunWithElevatedPrivilages() method.
You would get errors like,
'Microsoft.SharePoint.SPException'
base {System.ApplicationException}: {"Cannot complete this action.\n\nPlease try again."}
ErrorCode: -2147467259
UserProfileChangeJobSchedule: 'new UserProfileManager(context,false).UserProfileChangeJobSchedule' threw an exception of type 'Microsoft.SharePoint.SPException'
SPSecurity.RunWithElevatedPrivilages(delegate()
{
ServerContext context = ServerContext.GetContext("SharedServices2");
UserProfileManager manager = new UserProfileManager(context);
});
Anonymous comments are disabled