Jun 30 2019 11:56 PM
Hey guys,
Just recently have turned on group expiration policy for one client, we done a research and it appeared a great idea, however after some time we got a feedback that some teams need to go back to their documents even 3 years after the Teams channel gets created. And here is the question: is is possible to renew Teams / Outlook Groups in bulk using PowerShell? This particular team told us that they got like hundreds of groups, and renewing them even once a year is a pain. Or maybe there is a way to exclude particular Teams from participating in policy?
Appreciat eyour help,
Kind regards,
J
Jul 01 2019 10:07 AM
There's no "exclude" option, but there is an "include" one, so you can do the opposite. As for bulk renewal, you can use the Graph API: https://docs.microsoft.com/en-us/graph/api/grouplifecyclepolicy-renewgroup?view=graph-rest-beta&tabs...
Jul 02 2019 06:19 AM
Hi@VasilMichev I was tryingn to use Graph API - and almost got it. The problem is that via Graph Explorer I am able to renew the group by using POST groups/{groupid}/renew command - it works great, but when trying to do the same with PowerShell using this command:
Invoke-RestMethod -Uri 'https://graph.windows.net/<domain>.onmicrosoft.com/groups/8c8dce4c-9e61-4617-b111-22073d5f6d39/renew...' -Headers $GraphToken -Method POST
I got:
Invoke-RestMethod : {"odata.error":{"code":"Request_BadRequest","message":{"lang":"en","value":"Specified HTTP method is not allowed for the request target."},"requestId":"0b54628a-8859-4c01-ae51-43db84dgf4c0","date":"2019-07-02T13:18:24"}}
At line:1 char:1
+ Invoke-RestMethod -Uri 'https://graph.windows.net/<domain>.onmicrosoft.co ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
According to documentation it should work, and it does - using graph explorer on web browser, from some reason it does not work however via powershell.
Was fighting for whole days today - no progress..
Jul 08 2021 03:21 PM
@Pawel Jarosz Hello. I am very curious did you get this to function properly?
Jul 08 2021 09:35 PM
Jul 13 2021 11:25 AM
Jul 13 2021 11:35 AM
Jul 14 2021 10:37 PM
Sep 06 2024 07:17 AM
@Pawel Jarosz Invoke-MgRenewGroup -GroupId $Group.Id