401 when i try to change permissions with addroleassignment...

Mar 16, 2015 at 10:08 AM
Hi everybody,

When i try to change permissions with "addroleassignment", i receive a 401 as error.

RequestorId: 777a6b8d-8a79-edcd-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ArgumentException: AddRoleAssignment-BreakRoleInheritance Exception: The server responded with a status of 401 (Unauthorized). Request Uri: https://blabla.sharepoint.com/sites/Extranet/testblabla/testwf/Forms/DispForm.aspx?ID=2/breakroleinheritance(false) at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) Exception from activity Throw Sequence Check response status code BreakRoleInheritance Logic Break Role Inheritance MakeApiCalls AddRoleAssignment Artezio.SP.WorkflowActions.AddRoleAssignment Stage 1 Sequence Flowchart Sequence testwf.WorkflowXaml_474aa9a5_56ff_47ac_99e3_125ad7ca936a

I granted the permissions for the workflow.

I don't understand why i receive this error.

Can you help me ?

Thank you in advance.
Mar 18, 2015 at 10:21 AM
Please make sure you're using AppOnlySequence activity. Thus workflow only permissions will be used which allow changing permissions. Otherwise, it'll use the same permissions of user and workflow, and if any of them doesn't have permission it'll throw such an error.
Mar 18, 2015 at 9:08 PM
Thank You for your answer.

But how and where can i put the information apponlysequence ?

Thank You in advance.
Mar 18, 2015 at 9:41 PM
Do you use SharePoint Designer or Visual Studio to build the Workflow?
Mar 18, 2015 at 9:55 PM
Sharepoint désigner.
Apr 13, 2015 at 11:10 AM
Edited Apr 13, 2015 at 11:41 AM
I have a similar problem.
i'm trying to use the OOTB way to achieve this using an app step.
I'm also receiving unauthorized error.
Is this possible to do using OOTB? Or is using this SPD activity the only way?

Apr 14, 2015 at 4:35 PM
Sorry for a late response.

Please follow this (https://msdn.microsoft.com/en-us/library/office/jj822159.aspx) article to elevate you SPD workflow permissions. You need to put your action inside App Step that becomes available after you create your WF app and give it additional permissions.

App Step should evaluate your WF permissions to the permissions you specify. Then the WF will make a call to web service using it's identity, not user and make the required action.

Please let me know if it helps you.
Apr 16, 2015 at 4:13 PM
Edited Apr 16, 2015 at 4:14 PM
thank you for your response. I got it to work after re-applying the app permissions for workflow.
The weird thing is, the workflow app permissions were already activated.
My problem is now somewhere else.
Thank you for your breakroleinheritance blogpost. It helped out a lot.

Regards, Robert
Sep 15, 2017 at 8:37 AM
Edited Sep 15, 2017 at 8:38 AM
I tried to do like the article, but the error still occurs. What else can to do?