views:

16

answers:

0

Hi all,

I'm new in UserProfileManager recently. Now, I'm develop a workflow with UserProfileProperty. And I'm getting a problem at runtime of workflow.

If you all do not mind, before I show my code snippet, I want you all see and think about my situation as below:

1. Assume that I 'm running workflow with this account ("domain\user1") and make sure I run with user token. This user has full control and I'm running this workflow on site collection A.

2. This user ("domain\user1") added by webapppool account to "Personalization services permissions" on SSP site collection. NOTICE that it only added from AD to there then and do nothing . And I did to enable check boxes all permissions for this user through this webapppool.

Note: SSP site collection run on another webapp and not the same webapp.

and show my code snippet.

.........something above..........

SPUser user = mSite.RootWeb.SiteUsers["domain\user1"]; SPUserToken userToken = user.UserToken; this.site = new SPSite(mSite.ID, mSite.Zone, userToken);

ServerContext context = ServerContext.GetContext(this.site); UserProfileManager profileManager = null; //SPSecurity.RunWithElevatedPrivileges(delegate //{ profileManager = new UserProfileManager(context);//the exception occurs right here //}); UserProfile u = profileManager.GetUserProfile(this.LoginName);

Here, I attemped to avoid using Security. RunWithElevated.... to specify the permission of user running. Hope you all get that

And finally, I caught this error like this :

ex.ToString()    "Microsoft.SharePoint.SPException: Cannot complete this action.\n\nPlease try again. --->

System.Runtime.InteropServices.COMException (0x80004005): Cannot complete this action.\n\nPlease try again.\r\n at Microsoft.SharePoint.Library.SPRequestInternalClass.CalculatePermissionsForCurrentThread(Object& pvarAcl, Boolean bOnlyAces, UInt64& pPermGrant, UInt64& pPermDeny, Boolean& pbIsSiteAdmin, Boolean& pbIsSiteAuditor)\r\n at Microsoft.SharePoint.Library.SPRequest.CalculatePermissionsForCurrentThread(Object& pvarAcl, Boolean bOnlyAces, UInt64& pPermGrant, UInt64& pPermDeny, Boolean& pbIsSiteAdmin, Boolean& pbIsSiteAuditor)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.SharePoint.Library.SPRequest.CalculatePermissionsForCurrentThread(Object& pvarAcl, Boolean bOnlyAces, UInt64& pPermGrant, UInt64& pPermDeny, Boolean& pbIsSiteAdmin, Boolean& pbIsSiteAuditor)\r\n at Microsoft.SharePoint.Administration.SPAcl1.CalculatePermissions()\r\n at Microsoft.SharePoint.Administration.SPAcl1.DoesUserHavePermissions(T permissions)\r\n at Microsoft.Office.Server.Infrastructure.SharedServiceAccessControlList.AccessCheck(SharedServiceRights rights)\r\n at Microsoft.Office.Server.UserProfiles.SRPSite.CanManagePeople()\r\n at Microsoft.Office.Server.UserProfiles.UserProfileManager.get_IsSiteAdmin()\r\n at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(ServerContext serverContext, Boolean IgnoreUserPrivacy, Boolean backwardCompatible)\r\n at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(ServerContext serverContext)\r\n

So, could you all let me know what''s happenning and let me know your solution ? The problem right here, I want to know the permission at least on this user to excecute this snippet code.

Thanks in advance,

Standley Nguyen

related questions