@ort_tt , I just tested this api and it worked for me. Let me share the detailed steps below:
- Use Authorization Code Grant Flow to fetch a token for your App from AAD.
- Once you have the code use it to request for an access_token from AAD. make sure the following delegated permission "Mail.ReadWrite" is present on the app registration that is being used here.
- Call the following Graph API.
API: https://graph.microsoft.com/v1.0/userPrincipalName/mailFolders/{id}/childFolders
Body:
{
"displayName": "{Child Folder Name}",
}
This is the ID for my inbox "AAMkADAwZmE5NGU1LWJlYzAtNGE0ZS1hZDI4LWZmNmU0MDdjNzgyZQAuAAAAAABh0v7KYQaiRob9eDRfUq1JAQDBRn5LIsmdTKmOCwZeGkgvAAAAAAEMAAA="
Once you make the api call, you should get status 200 OK and the child folder should be present in your outlook:
Hope this helps.
Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as Answer; if the above response helped in answering your query.
@ort_tt , Sorry for the delay in response. As far as I understood, when you are running the Get-MailboxFolderStatistics its adding some extra characters before the FolderID. I guess to get things moving for you, you would have to somehow parse and remove the extra characters and get the actual Folder ID, or one more thing that you can do is make a graph api call to list the folders and then fetch the folder ID from there and feed it to the next instruction in your script.
API: GET https://graph.microsoft.com/v1.0/me/mailFolders
More info: https://learn.microsoft.com/en-us/graph/api/user-list-mailfolders?view=graph-rest-1.0&tabs=http
Hope this helps.
Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as Answer; if the above response helped in answering your query.
@ort_tt , Just wanted to followup with you to check if the above response helped in answering your query. If it did, please do not forget to accept the response as Answer; if the above response helped in answering your query. If it didn't, please do let us know so that we can try to help you further.
Sorry for the late reply.
I was able to solve it with the contents you taught me.
Thank you for your answers when you are busy.
Sign in to comment