AnsweredAssumed Answered

AddPermissionsCollection dynamic creation of permissionsInfoXML string

Question asked by duane on Jul 8, 2015
Latest reply on Jul 9, 2015 by duane

I need to dynamically add user permissions to a site. I will be using the AddPermissionsCollectionWebService: https://msdn.microsoft.com/en-us/library/websvcpermissions.permissions.addpermissioncollection.aspx

 

e.g.

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

  <soap:Body>

    <AddPermissionCollection xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">

      <objectName></objectName>

      <objectType>Web</objectType>

      <permissionsInfoXml>string</permissionsInfoXml>

    </AddPermissionCollection>

  </soap:Body>

</soap:Envelope>

 

Essentially I need to build a dynamic XML string that would look something like this:

<Permissions>

<Users>

<User LoginName="i:0#.f|membership|test1@test.net" Email=test1@test.com" Name="Test 1" Notes="Notes" PermissionMask="1011030767"/>

<User LoginName="i:0#.f|membership|test2@test.net" Email="test2@test.com" Name="Test 2" Notes="Notes" PermissionMask="1011030767"/>

<User LoginName="i:0#.f|membership|test3@test.net" Email="test3@test.com" Name="Test 3" Notes="Notes" PermissionMask="1011030767"/>

</Users>

</Permissions>

 

For the purposes of my current requirement, the permissions are the same for each user.

 

The users will be fetched from a Group/Person field in a list which will allow for multiple select (this field will be copied to a string variable as I don't seem to have the option to evaluate Person/Group field "is not empty"??). This field is not required, so this field could have 0,1 or many users assigned to it. I think the Run If command could be used, and must only run if the string var is not empty.

 

I'm would like some advice on how to build the dynamic list of users.

 

I have looked at some Nintex documentation on the internet: Tutorial: Adding users to a new team site: How to create a site then provision its users using a workflow

However it seems that O365 is missing the ItemProperty functionality which is critical to this examples implementation - is this true?

 

I know that I can get the users info by reading the ListItem Field and could use this to build the string, but I'm not sure how I would handle looping though the people assigned to the field...and also wonder if this is the best design approach.

Nintex_SelectReturnType.png

 

 

My Requirement is not exactly the same as I need to concatenate the PermissionMask to each user's meta data.

 

Discussion/thoughts are welcome. I'm sure this problem has been solved before

 

Message was edited by: Duane Stavropoulos (fixed typo in email address)

Outcomes