Forum Discussion
Setting Unified Group properties via API
The Set-UnifiedGroup PowerShell commandlet has a couple of interessting properties. In particular, hiding the group from the global address list (HiddenFromAddressListsEnabled) and enabling/disabling the welcome e-mail (UnifiedGroupWelcomeMessageEnabled).
Is there a way to set these properties either as default for the entire O365 tenant or via the Graph API on a per group basis?
Background info:
I am looking for a way to do this without PowerShell, on purpose, because I am working on a provisioning solution coded in C# (and not PowerShell). All provisioning actions should run in the same thread...
30 Replies
- Matthias HabeggerCopper Contributor
You can do that with Microsoft Graph only at creation time. I'm disabling the member notification on group adding like this:
Like this:
Url: https://graph.microsoft.com/v1.0/groups
Request Body:
--
{
"displayName": "TestGroup-01",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "testgroup-01",
"resourceBehaviorOptions": [
"WelcomeEmailDisabled"
],
"securityEnabled": false,
"visibility": "Private",
}--
- Julian_DanoCopper Contributor
Thanks for posting this! Can you post where you found this? I'm curious as to the other options available within the resourceBehaviorOptions attribute. Thanks
- ShaneOssBrass Contributor
Julian_Dano @Matthias Habegger
Values for resourceBehaviorOptions:
- AllowOnlyMembersToPost
- CalendarMemberReadOnly
- ConnectorsEnabled
- HideGroupInOutlook
- NotebookForLearningCommunitiesEnabled
- ReportToOriginator
- SharePointReadonlyForMembers
- SubscriptionEnabled
- SubscribeMembersToCalendarEvents
- SubscribeMembersToCalendarEventsDisabled
- SubscribeNewGroupMembers
- WelcomeEmailDisabled
- WelcomeEmailEnabled
- Brett ZeigerbacherCopper ContributorGreat! I can confirm this works to disable the welcome email on site creation:
"resourceBehaviorOptions": [
"WelcomeEmailDisabled"
],
I don't know where you found this because there is no mention of this command anywhere but I'm glad you posted it. - Marco_DisselBrass Contributor
Thanks!
The documentation does not mention this (new) property.. How did you get this information?
- Don DeCarloBrass Contributor
Dear Berend
Yes is looks like you can use the Graph API to update these as well. That is pretty cool.
You have to find the directory template object for "Unified groups" using the API and then reference that template when updating the particular group.
(https://graph.microsoft.com/beta/directorySettingTemplates)
Love the Microsoft graph. Sounds like another addin that we can create that would make it easier to update these settings. Let's collaborate if you like. You can schedule a quick online meeting with me using our https://outlook.office365.com/owa/calendar/DeCarloSoftware2@decarlosoftware.com/bookings/ Use the option for the free "Products questions and answers" session. If not I will let you know after we create the addin.
- Andy_nigamCopper Contributor
Hey Don,
Would you be kind to share a key part of the code to suppress welcome email ?
Don DeCarlo wrote:
Dear Berend
Yes is looks like you can use the Graph API to update these as well. That is pretty cool.
You have to find the directory template object for "Unified groups" using the API and then reference that template when updating the particular group.
(https://graph.microsoft.com/beta/directorySettingTemplates)
Love the Microsoft graph. Sounds like another addin that we can create that would make it easier to update these settings. Let's collaborate if you like. You can schedule a quick online meeting with me using our https://outlook.office365.com/owa/calendar/DeCarloSoftware2@decarlosoftware.com/bookings/ Use the option for the free "Products questions and answers" session. If not I will let you know after we create the addin.
The API reference doesn't say which key needs to be off. I may have missed it as I am not very familiar with MS group underneath.- Marco_DisselBrass Contributor
Anyone found the url/setting to disable the unifiedgroupwelcomemessageenabled via the msgraph?
- Bernd RickenbergBrass Contributor
Thanks for your response. Interessting with the directorySettingTemplates. Unfortunately it looks like it does not solve my problem, because the template does not expose the welcome mail and GAL settings.
- Don DeCarloBrass Contributor
Dear Bernd
I see that now. Those settings are on the mailbox in exchange rather than the Group. I put together a quick app with a button on the Groups ribbon "update settings". That pops a Custom task pane in Outlook with a simple update on the mailbox settings for that group. Is that what you are looking for?Let me know more details and as I said we can work together. https://outlook.office365.com/owa/calendar/DeCarloSoftware2@decarlosoftware.com/bookings/
Philisophical question: If an issue is easily solved in a one-line PowerShell command, why would you even think about writing some code to do the same thing with the Microsoft Graph? Much as I like the Graph (see https://www.petri.com/exploring-office-365-graph-explorer), there is no point in recreating wheels, even if the new wheel is extra-sparkly.
- doughortonCopper Contributor
TonyRedmond One reason is if you -- like me -- are developing hosted services for use in a client's tenant and must use graph API calls to accomplish tasks like this because your code does not run within the client's network.
Get-UnifiedGroup | Set-UnifiedGroup -HiddenFromAddressListsEnabled $True...
- Bernd RickenbergBrass ContributorSorry, but I need a C# solution. PowerShell will not do in my case - I have added a bit background info to the question.
Fair enough, PowerShell can't do everything...