You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please open a question/ticket at https://developer.microsoft.com/en-us/graph/support for assistance around permissions and API related issues. Permission validation is handled by the API and not the module.
Hi Gents,
I'm trying to use the Graph SDK to manage organization contacts for internal employees via a runbook.
I see from the MS documentation that app-only authentication is supported:
https://learn.microsoft.com/en-us/powershell/microsoftgraph/app-only?view=graph-powershell-1.0&tabs=powershell
Therefore, I’m connecting as follows:
Here is the output:
Despite using the app-only authentication and having "Contacts.ReadWrite" permission, I’m getting "access is denied" errors on all below commands:
-$folderStaffDirectory = Get-MgUserContactFolder -UserId $Mbx.UserPrincipalName | Where-Object {$_.DisplayName -eq $folderName}
New-MgUserContactFolderContact -UserId $Mbx.UserPrincipalName -BodyParameter $params -ContactFolderId $folderStaffDirectory.Id -DisplayName $Contact.DisplayName -CompanyName $Contact.CompanyName -Department $Contact.Department -JobTitle $Contact.JobTitle -PersonalNotes $OrgNotes -MobilePhone $Contact.Mobile
[array]$ContactsInMbx = Get-MgUserContactFolderContact -UserId $Mbx.UserPrincipalName -ContactFolderId $folderStaffDirectory.Id -All
$folderStaffDirectory = New-MgUserContactFolder -UserId $Mbx.UserPrincipalName -BodyParameter $paramsFolder
Error example:
Get-MgUserContactFolder : Access is denied. Check credentials and try again. At line:91 char:2 + $folderStaffDirectory = Get-MgUserContactFolder -UserId $Mbx.User ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: ({ UserId = conf..., Property = }:<>f__AnonymousType31
7) [Get-MgUserContactFolder_List1], RestException1 + FullyQualifiedErrorId : ErrorAccessDenied,Microsoft.Graph.PowerShell.Cmdlets.GetMgUserContactFolder_List1
Is there anything wrong ?
Please feel free whether you need more details.
Thanks in advance.
Cheers,
Patrick
The text was updated successfully, but these errors were encountered: