Is there a way to set child site permissions with a workflow on the parent site?


Userlevel 3
Badge +8

I have a need to change permissions on project sites once the site is set to archived. Is it possible to change site permissions with a workflow? I see item permissions...

Thanks in advance for your help! happy.png

Kassie


18 replies

Badge +16

You can set permissions with web service calls

Badge +16

Permissions Web Service

Userlevel 6
Badge +12

We do this in our automated site provisioning workflow! We do it across site collections so that we can leverage site templates on different collections.

If you need any examples or help, let us know

Badge +3

I have a requirement to do something similar to this.  My issue is that the sub-site being created by our workflow stores the new site URL in a workflow variable, and I'm trying to use that new URL reference in the URL for the Web Service call so that it's calling the web services associated with the newly created sub-site.  However, I'm unable to select a Web Method in the configuration for AddGroup since the site URL I'm trying to use technically isn't created yet until a user fills out our form and provides a site name for the new site.

How did you get around this, did you have to put the group creation and permissioning in a separate workflow that's called by the site creation workflow?

Thanks!

Userlevel 6
Badge +12

I did separate out those steps, but I am using a workflow variable as well to pass along the newly created URL.

197939_pastedImage_2.png

What I did was put in a legit URL, so I can select the proper service, and then once set, replace the URL with the variable.

Also, you should be prompted with a dialog box if the URL contains a variable:

197941_pastedImage_3.png

This gives you a chance to provide a real example of what the variable could hold.

Hope this helps!

Badge +3

Ok, that's what I had did at first (using legit URL to get the methods and then substitute for the workflow variable) but got some SOAP exception errors when I tried to test the workflow.

Would you suggest a pause or a wait, or is there a way to check that the site creation action has taken place before the call of web service actions are run?

Userlevel 6
Badge +12

We added in a pause step to allow the system to create the site. If I remember correctly, we ran into similar issues when the site creation and permission actions were in the same workflow, and that is why we separated them out.

If you are still running into issue after pausing for 5 minutes, separate out the permission steps and put them in another workflow. Then all you need to do is call that workflow and pass over the variables required. So something like this:

197943_pastedImage_1.png

197944_pastedImage_2.png

Hope this helps!

Badge +3

Looks good, I've added the pause for 5 minutes actions and going through unit testing of that change now to see if we get the same errors as before.  I appreciate the help!

This is how I currently have it set up, have added Commit Pending Changes actions also.

Userlevel 6
Badge +12

Commit pending changes action should really only be used just before you need to reference some data from something that a workflow updated (check out   for more details). Not sure how the rest of your workflow is designed, but you may not need them.

Also, just a thought, you could move the pause step to just before the Run in parallel action to save steps. Same thing with the commits, since you are only setting workflow variables between the steps.

Let me know how it works out for you!

Hope this helps!

Badge +3

Tried it out with the Pause for 5 minutes action and still receiving these "Failed to invoke web service." errors:

1/26/2017 3:35 PMWorkflow CommentFailed to invoke web service. Error returned from server: <soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. 
1/26/2017 3:35 PMWorkflow CommentFailed to invoke web service. Error returned from server: <soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. 
1/26/2017 3:35 PMWorkflow CommentFailed to invoke web service. Error returned from server: <soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. 
1/26/2017 3:35 PMErrorAn error has occurred in PBC Delivery - Project Request Sub-Site Creation Workflow.
Userlevel 6
Badge +12

Try to do them one at a time rather than in parallel. I have ours setup sequential actions.

197955_pastedImage_1.png

In each action set I am creating the group and then applying the group.

Userlevel 6
Badge +12

Have you tested the web service by doing a Run now within the web service action? Does that work?

I ran into some issues around my variables and the way I was pushing through the URL. 

Badge +3

When I try run now, Test Connection returns OK in results, but executing the Web method gets me a 500 Internal Server Error.

Userlevel 6
Badge +12

Hmmm... so it looks like it is the method that is failing. This is the tedious part, checking that the request is setup properly and that the variables are all in the right format.

First, I would validate all your variables (send them to yourself in an email via the workflow or output them with log history action) and try to see if they are what you expect. After that, you may need to step through the service call to ensure it is setup properly with the variables. I created a test site and created and added the permissions there to see that it would work.

Here is an example of one of my web service calls (usergroup.asmx  AddGroup ):

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/directory/">
<soap:Header>
</soap:Header>
<soap:Body>
  <m:AddGroup>
    <m:groupName>{WorkflowVariable:siteOwnersGroup}</m:groupName>
    <m:ownerIdentifier>{WorkflowVariable:newSiteOWNER}</m:ownerIdentifier>
    <m:ownerType>user</m:ownerType>
    <m:defaultUserLoginName>{WorkflowVariable:newSiteOWNER}</m:defaultUserLoginName>
    <m:description>
    </m:description>
  </m:AddGroup>
</soap:Body>
</soap:Envelope>

And then to add the group to the site (permissions.asmx  AddPermission ):

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/directory/">
<soap:Header>
</soap:Header>
<soap:Body>
  <m:AddPermission>
    <m:objectName>{WorkflowVariable:newSiteURL}</m:objectName>
    <m:objectType>Web</m:objectType>
    <m:permissionIdentifier>{WorkflowVariable:siteOwnersGroup}</m:permissionIdentifier>
    <m:permissionType>group</m:permissionType>
    <m:permissionMask>-1</m:permissionMask>
  </m:AddPermission>
</soap:Body>
</soap:Envelope>

Also, I am not sure why I did not mention this before, but I created an asset in   for this awhile back. Check out Site Creation Workflow  if you want to see how I did mine.

Hope this helps!

Badge +3

Yea, I think I may need to get my server team involved and see what's going on.  My setup is almost identical as yours.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/directory/">
<soap:Header>
</soap:Header>
<soap:Body>
  <m:AddGroup>
    <m:groupName>{WorkflowVariable:siteOwnersGroup}</m:groupName>
    <m:ownerIdentifier>{WorkflowVariable:newSiteOwner}</m:ownerIdentifier>
    <m:ownerType>user</m:ownerType>
    <m:defaultUserLoginName>{WorkflowVariable:newSiteOwner}</m:defaultUserLoginName>
    <m:description>
    </m:description>
  </m:AddGroup>
</soap:Body>
</soap:Envelope>

Userlevel 6
Badge +12

Well best of luck! It can be done so you just need to pinpoint the issue. I think you are close!

Let me know if you need anything else or have any questions.

Badge +16

‌ did any of the responses resolve your issue?  Are you able to mark any correct?

Badge +8

Hey Jessie. I would love to see how that works. Hope all is well at Nintex. 

 

Dean Virag

Reply