The process of building custom applications and tools that interact with Microsoft Exchange Server
Please note that Q&A forum is a public platform, and moderators will modify the question to hide personal information in the description. Kindly ensure that you hide any personal or organizational information the next time you post an error or other details to protect personal data.
Based on the error, I do not think the issue is with the JSON body. The error Resource`` ``not`` ``found`` ``for`` ``the`` ``segment`` ``'distributionLists' indicates that Microsoft Graph is not resolving the distributionLists segment in the request URI.
Please make sure you are not using the literal placeholder {userPrincipalName} in the URL. Replace it with the actual user principal name, for example:
POST`` ``https://graph.microsoft.com/beta/users/******@domain.com/distributionLists
or test first with:
POST`` ``https://graph.microsoft.com/beta/me/distributionLists
Also confirm that the token has the required Contacts.ReadWrite permission. Since this API is currently under Microsoft Graph /beta, it may be subject to change and may not be available in all environments. I would also suggest testing GET`` ``https://graph.microsoft.com/beta/me/distributionLists. If that returns the same Resource`` ``not`` ``found error, the endpoint is likely not currently available for your tenant/mailbox path rather than being a request body issue.
If the requirement is to create a tenant-level Exchange Online distribution group, the recommended and stable approach is to use Exchange Admin Center or Exchange Online PowerShell with New-DistributionGroup.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.