Skip to main content
Nintex Community Menu Bar

Get email of all members of SharePoint Group from Nintex Workflow Cloud workflow

  • October 23, 2020
  • 10 replies
  • 452 views
  • Translate

Forum|alt.badge.img+1

I need to get email of each member of SharePoint group from NWC so I could email them. Noticed that there are out of the box actions available to add/remove users from SharePoint group though. Please Help. Thanks
 

9313i07737D80D429FD26.png

 

Did this topic help you find an answer to your question?

10 replies

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • 260 replies
  • October 26, 2020

@Saran-Talan are you actually using a SharePoint permission group, or are you actually using a Microsoft 365 group? There is a way to get members of a Microsoft 365 (or Teams) groups, however getting members from a SharePoint permissions group is a little more challenging.

Translate

Forum|alt.badge.img+1
  • Author
  • Rookie
  • 4 replies
  • October 28, 2020

Hi @butlerj, Thanks for your reply, I'm using SharePoint permission group. When you saying challenging, does it means that there is no out of the box action/solution to do this please? if so, what would be the custom solution to achieve the same please.

Translate

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • 260 replies
  • October 28, 2020

@Saran-Talan Correct there is no "out of the box" action that will do this for you. However you should be able to make a web service call to the SiteGroups API to get members from a group:

 

_api/Web/SiteGroups/GetByName('SiteName Members')/users

You should also be able to query specific member properties using the query selector on that end point:

_api/Web/SiteGroups/GetByName('SiteName Members')/users?$select=Email

 

I haven't done this myself in NWC (just O365), but it should be doable. I'll see if I have time today to play around with the web service permissions to get this sorted.

Translate

Forum|alt.badge.img+1
  • Author
  • Rookie
  • 4 replies
  • October 28, 2020

Thanks @butlerj , I'll too try the same using the web service call and would let you know. 

Translate

Hi @butlerj, I have tried web service call action to get the members of a SharePoint group. However, I have been getting access denied error (screenshot attached). When hitting this request in browser, I am getting the response.

Could you find a way to achieve this?

Translate

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • 260 replies
  • February 18, 2021

@Akshat_Saxena are you able to test the request with a tool like Postman? The issue is most likely coming from the type of authentication you have in front of your SharePoint Online environment and you needing to get a Bearer token. If you're already signed into your site via the browser just using the URL will pass through your authentication to the GET request so it's not a perfect test of the end point. 

Translate

Thanks @butlerj. I am able get response for my request using Postman.

The problem I am facing now is that the access token expires after 24 hours.

I am wondering how to solve this issue and be able use 'Call a web service' action uninterruptedly in NWC to access SharePoint Online data. Any ideas/inputs regarding this.

 

Translate

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • 260 replies
  • March 19, 2021

@Akshat_Saxena typically this will involve a two step process. Before you make your call to create the group you will make a call to get the updated access token from Azure AD. This way each time the workflow runs you will always get an updated token. I'm actually a little surprised that your token lasts for 24 hours, as most would only last for a couple minutes for security purposes. 

 

Let me know if that makes sense.

Translate

  • 1 reply
  • December 22, 2021

Hi @Akshat_Saxena 

 

Did you ever work this one out? Were you able to use a web service and did you also have to get the token each time?

 

Jo

Translate

Forum|alt.badge.img+3

Once you get the response back from the HTTPS request, you can regex it into a collection.

Regex: (?<=Email":")(.*?)(?="})

 

Then loop through the collection and append the emails to a string variable. You can then use the string variable in the To section of the email.

 

It's not ideal, but it works. It would be great if there was a "Get SharePoint Group Members" action in NWC.

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings