cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
agaskelluk
Frequent Visitor

Add a user to multiple Sharepoint Groups

Hi All

I want to add a user to multiple SharePoint groups in different site collections in the same flow. 

 

I am able to add the user to a single SharePoint group, but one or the other REST API calls do not add the user to the group. The API calls do not fail but they do not add the user. Sometimes the first API call does not add the user, sometimes the 2nd. They both return a status code of 201 and the output looks OK in the flow run. 

 

Here is what I have, adding a single user to two different groups in two different site collections:

 

Capture.PNG 

 

Any help appreciated!

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @v-litu-msft 

In fact I already tried using the delay in cast the request was taking too long, but it did not help.

 

I then discovered some interesting behaviour where if the user had already been added to the group but subsequently removed, when he/she is added for the 2nd/3rd/nth time, the behaviour is unpredictable. Sometimes they get added, sometimes not.

 

I was repeating my tests with the same user - add to group using flow, remove manually, re-run flow. This seems to be the cause of the issue. I am guessing its some caching or possibly a delay whilst the user is removed from the back-end.

 

I was able to prove this is the problem by testing with a different user everytime. When I use a unique user, it succeeds every time.

Thanks for the response anyway.

 

Andrew

View solution in original post

2 REPLIES 2
v-litu-msft
Community Support
Community Support

Hi @agaskelluk,

 

Could you please add a delay action between two Send HTTP request action?

For example:

Annotation 2020-07-23 135110.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-litu-msft 

In fact I already tried using the delay in cast the request was taking too long, but it did not help.

 

I then discovered some interesting behaviour where if the user had already been added to the group but subsequently removed, when he/she is added for the 2nd/3rd/nth time, the behaviour is unpredictable. Sometimes they get added, sometimes not.

 

I was repeating my tests with the same user - add to group using flow, remove manually, re-run flow. This seems to be the cause of the issue. I am guessing its some caching or possibly a delay whilst the user is removed from the back-end.

 

I was able to prove this is the problem by testing with a different user everytime. When I use a unique user, it succeeds every time.

Thanks for the response anyway.

 

Andrew

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,291)