r/MsGraphPowerShell • • Jan 07 '25

Question can't find data on certain resource accounts

1 Upvotes

I'm attempting to get info on some of our resource calendars. Since this doesn't function well within the EXO Powershell, I was pointed towards the MSGraph module.

So I use these commands:

 $StartDate = "2024-01-01T19:00:00-08:00"
>> $EndDate = "2024-12-31T19:00:00-08:00"
>> Get-MgUserCalendarView -UserId "[email protected]" -All -StartDateTime $StartDate -EndDateTime $EndDate | Select-Object -Property @{Name='EventStart';Expression={ $_.Start.DateTime}},@{Name='EventEnd';Expression={ $_.End.DateTime}},Subject, BodyPreview | Export-CSV "c:\temp\xxx.csv"

And this works fine for almost every resource I have tried this on. But one set of resource mailboxes gives this as a result:

Get-MgUserCalendarView_List:
Line |
   3 |  Get-MgUserCalendarView -UserId "[email protected]" -All -Star …
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The specified object was not found in the store.

Status: 404 (NotFound)
ErrorCode: ErrorItemNotFound
Date:

Headers:
Cache-Control                 : private
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : ab43f50a-55e9-49fa-a837-aca09feba628
client-request-id             : 607a9733-2835-4c51-8885-138338823e84
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"009","RoleInstance":"AM1PEPF00027CA5"}}
Date                          : Tue, 07 Jan 2025 15:22:11 GMT

This set of resource mailboxes are coincidentally all made at about the same time, but they were made in the same way as other resource mailboxes and are (just like the other resource mailboxes) made in our EXO environment with no links to anything on-prem.

Does anyone have any idea what is going wrong?


r/MsGraphPowerShell • • Nov 06 '24

Question Looking for a solution - Microsoft Graph is rate limiting our bulk-emails

1 Upvotes

I am sorry if this is not the correct sub, the Microsoft Graph sub appears to be a dead sub.

We have an existing o365 EAC connector/rule that forwards emails from specific addresses through the SMTP2GO connector. The emails are created from Hubspot, and the problem we are running into is Hubspot sends via REST not SMTP. Because of this, Microsoft Graph is rate limiting, causing massive amount of problems.

Microsoft has been for the most part useless, as we are stuck dealing with Vendor support.

Here is their analysis of the situation

We shared the information with our higher-level team engaged on the issue and they advised the below:

The error that is being observed is "statusCode = 429 and "error":{"code":"ApplicationThrottled","message":"Application is over its IncomingBytes limit."}}," when sending emails through HubSpot. It indicates that the application is over its IncomingBytes limit. From our analysis, it seems that the messages may not be submitted using SMTP but rather through the REST protocol. The error indicates that the mailbox is writing data too frequently into Store, it could be the total payload/data is too huge during a certain time.

To resolve this issue, please check the data you are trying to write and consider slowing down the writing process to avoid this type of throttling. For more detailed guidance, you can refer to the Microsoft Graph throttling documentation, See Microsoft Graph throttling guidance - Microsoft Graph | Microsoft Learn

These instructions seem to indicate we need to adjust code on Hubspot or SMTP2GO, but I am not an employee with either company and do not have access to their back-end systems.

Has anyone ran into this problem before?


r/MsGraphPowerShell • • Oct 02 '24

Set-MgUserPhotoContent for no admin

1 Upvotes

Hello,

I was using a graphical PowerShell script with a form, converted to an EXE, to allow HR users to change the photos of various users.

Connect-ExchangeOnline

Set-UserPhoto -Identity $user -PictureData ([System.IO.File]::ReadAllBytes($pictureBox1.ImageLocation)) -Confirm:$false

This was associated with a very limited Exchange role:

A custom role with "User Options" only.

It worked perfectly without giving any additional rights to the users.

However, the command has now become obsolete.

I’m now trying to update to the Graph API command:

Connect-MgGraph -ClientId $clientId -TenantId $tenantId -Scopes "ProfilePhoto.ReadWrite.All,User.ReadWrite.All"

Set-MgUserPhotoContent -UserId $user -InFile $pictureBox1.ImageLocation

And by registering an application in Entra with the following permissions:

  • ProfilePhoto.readwrite.all Delegate

  • User.readWrite.all Delegate

It works fine, but only if the user has the **Entra User Administrator** role. However, this role gives too many rights, and I don't want to allow users to modify passwords, for example.

When I check the description of the admin role, I see this:

`microsoft.directory/users/photo/update` - Update user photos.

So, I tried to create a custom role with only this permission.

But I can't find the corresponding permission in the custom roles list:

  • `microsoft.directory/devices/registeredUsers/read` – Read registered device users.

  • `microsoft.directory/devices/registeredUsers/update` – Update registered device users.

  • `microsoft.directory/users/appRoleAssignments/read` – Read user app role assignments.

  • `microsoft.directory/users/assignLicense` – Manage user licenses.

  • `microsoft.directory/users/basic/update` – Update basic user properties.

  • `microsoft.directory/users/contactInfo/update` – Update user contact information.

  • `microsoft.directory/users/deviceForResourceAccount/read` – Read the deviceForResourceAccount for users.

  • `microsoft.directory/users/directReports/read` – Read users' direct reports.

  • `microsoft.directory/users/extensionProperties/update` – Update user extension properties.

  • `microsoft.directory/users/identities/read` – Read user identities.

  • `microsoft.directory/users/jobInfo/update` – Update user job information.

  • `microsoft.directory/users/licenseDetails/read` – Read user license details.

  • `microsoft.directory/users/manager/read` – Read the user's manager.

  • `microsoft.directory/users/manager/update` – Update the user's manager.

  • `microsoft.directory/users/memberOf/read` – Read user group memberships.

  • `microsoft.directory/users/ownedDevices/read` – Read users' owned devices.

  • `microsoft.directory/users/parentalControls/update` – Update users' parental controls.

  • `microsoft.directory/users/passwordPolicies/update` – Update users' password policies.

  • `microsoft.directory/users/registeredDevices/read` – Read users' registered devices.

  • `microsoft.directory/users/reprocessLicenseAssignment` – Reprocess users' license assignments.

  • `microsoft.directory/users/scopedRoleMemberOf/read` – Read a user's membership to a Microsoft Entra role, limited to an administrative unit.

  • `microsoft.directory/users/sponsors/read` – Read user sponsors.

  • `microsoft.directory/users/sponsors/update` – Update user sponsors.

  • `microsoft.directory/users/standard/read` – Read basic user properties.

  • `microsoft.directory/users/usageLocation/update` – Update the usage location of users.

How can I give users the permission to only change profile photos without granting any unnecessary rights?


r/MsGraphPowerShell • • Oct 02 '24

Update-MgSiteListItem is not updatig item

1 Upvotes

Hello Guys,

Ive managed to connect to MgGraph and to retrive a SharePoint list and its items with the following commands:

mport-Module Microsoft.Graph.Sites

Connect-MgGraph -ClientId "xxxx" -TenantId "xxxx" -CertificateThumbprint "xxxx"

# ID del sito SharePoint e nome della lista

$siteId = "xxxx"

$listID = "xxxx"

$listItems = Get-MgSiteListItem -SiteId $siteId -ListId $listID -ExpandProperty "fields"

then i'm updating items in a cycle

foreach ($item in $listItems) {

[...]

$item.Fields.AdditionalProperties.Processed = $true

$item.Fields.AdditionalProperties.LastProcessDate = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")

Update-MgSiteListItem -SiteId $siteId -ListId $listID -ListItemId $item.Id -BodyParameter $item.Fields -debug

}

the command exit with an OK status, but it's not updating anything. here the debug output

DEBUG: [CmdletEndProcessing]: - Update-MgSiteListItem end processing.

DEBUG: [CmdletBeginProcessing]: - Update-MgSiteListItem begin processing with parameterSet 'Update'.

DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate', ContextScope: 'Process', AppName: 'MgGraph-Appreg-for-script'.

DEBUG: [Authentication]: - Scopes: [DeviceManagementManagedDevices.Read.All, Device.Read.All, Device.ReadWrite.All, Group.Read.All, Sites.ReadWrite.All, Group.ReadWrite.All, User.Read.Al

l, DeviceManagementConfiguration.Read.All, DeviceManagementManagedDevices.ReadWrite.All, RoleManagement.ReadWrite.Directory, GroupMember.ReadWrite.All, DeviceManagementConfiguration.Read

Write.All, DeviceManagementManagedDevices.PrivilegedOperations.All, DeviceManagementApps.ReadWrite.All, DeviceManagementApps.Read.All].

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:

PATCH

Absolute Uri:

https://graph.microsoft.com/v1.0/sites/xxxx.sharepoint.com%2Cca2a6e0d-d071-4bac-886d-c95e5f2dee8d%2Cd15593fe-44ef-44b4-83ac-dcee4f7976b8/lists/8947c43b-6930-4f75-b7c2-44ba4e2f6f0d

/items/4

Headers:

FeatureFlag : 00000043

Cache-Control : no-store, no-cache

User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.14393; en-US),PowerShell/5.1.14393.6343

Accept-Encoding : gzip

SdkVersion : graph-powershell/2.24.0

client-request-id : 34ac9048-3f32-45a0-9bea-1b1ca955c26a

Body:

{

"@odata.etag": "\"1dfb4af3-00bc-487f-8bd4-c199de5c15e0,1\"",

"UPN": "[email protected]",

"Connect": true,

"VPN": false,

"Processed": true,

"LastProcessDate": "2024-10-02T09:38:51Z",

"Modified": "2024-10-02T09:38:03Z",

"Created": "2024-10-02T09:38:03Z",

"AuthorLookupId": "13",

"EditorLookupId": "13",

"_UIVersionString": "1.0",

"Attachments": false,

"Edit": "",

"ItemChildCount": "0",

"FolderChildCount": "0",

"_ComplianceFlags": "",

"_ComplianceTag": "",

"_ComplianceTagWrittenTime": "",

"_ComplianceTagUserId": "",

"AppAuthorLookupId": "45",

"AppEditorLookupId": "45",

"id": "4"

}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:

OK

Headers:

Transfer-Encoding : chunked

Vary : Accept-Encoding

Strict-Transport-Security : max-age=31536000

request-id : f9d147f9-9ce4-41ee-9f99-43b3ca7ffb09

client-request-id : 34ac9048-3f32-45a0-9bea-1b1ca955c26a

x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF00000207"}}

OData-Version : 4.0

Cache-Control : no-cache

Date : Wed, 02 Oct 2024 09:38:52 GMT

ETag : "1dfb4af3-00bc-487f-8bd4-c199de5c15e0,2"

Body:

{

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('xxxx.sharepoint.com%2Cca2a6e0d-d071-4bac-886d-c95e5f2dee8d%2Cd15593fe-44ef-44b4-83ac-dcee4f7976b8')/lists('8

947c43b-6930-4f75-b7c2-44ba4e2f6f0d')/items/$entity",

"@odata.etag": "\"1dfb4af3-00bc-487f-8bd4-c199de5c15e0,2\"",

"createdDateTime": "2024-10-02T09:38:03Z",

"eTag": "\"1dfb4af3-00bc-487f-8bd4-c199de5c15e0,2\"",

"id": "4",

"lastModifiedDateTime": "2024-10-02T09:38:52Z",

"webUrl": "https://xxxx.sharepoint.com/sites/xxx/Lists/xxxx/4_.000",

"createdBy": {

"user": {

"email": "xxxx",

"id": "b4695f7b-bbdf-4a43-8b36-6f58389fe364",

"displayName": "xxxx"

}

},

"lastModifiedBy": {

"application": {

"id": "df28db6d-5231-468f-be00-0f92cc66b340",

"displayName": "Microsoft Graph"

},

"user": {

"displayName": "SharePoint App"

}

},

"parentReference": {

"id": "9bed032d-46dd-4b95-95fd-701850e19df5",

"siteId": "xxxx.sharepoint.com,ca2a6e0d-d071-4bac-886d-c95e5f2dee8d,d15593fe-44ef-44b4-83ac-dcee4f7976b8"

},

"contentType": {

"id": "0x01007AD30E56CF862E4DAF725232066195130049DC9C38BF7D1D4494412ACB10C7DDAF",

"name": "Item"

},

"[email protected]": "https://graph.microsoft.com/v1.0/$metadata#sites('xxxx.sharepoint.com%2Cca2a6e0d-d071-4bac-886d-c95e5f2dee8d%2Cd15593fe-44ef-44b4-83ac-dcee4f7976b8')/li

sts('8947c43b-6930-4f75-b7c2-44ba4e2f6f0d')/items('4')/fields/$entity",

"fields": {

"@odata.etag": "\"1dfb4af3-00bc-487f-8bd4-c199de5c15e0,2\"",

"UPN": "[email protected]",

"Connect": true,

"VPN": false,

"Processed": false,

"LastProcessDate": "2024-10-02T09:38:03Z",

"id": "4",

"ContentType": "Item",

"Modified": "2024-10-02T09:38:52Z",

"Created": "2024-10-02T09:38:03Z",

"AuthorLookupId": "13",

"EditorLookupId": "1073741822",

"_UIVersionString": "2.0",

"Attachments": false,

"Edit": "",

"ItemChildCount": "0",

"FolderChildCount": "0",

"_ComplianceFlags": "",

"_ComplianceTag": "",

"_ComplianceTagWrittenTime": "",

"_ComplianceTagUserId": "",

"AppAuthorLookupId": "45",

"AppEditorLookupId": "46"

}

}

10/2/2024 9:38:03 AM "1dfb4af3-00bc-487f-8bd4-c199de5c15e0,2" 4 10/2/2024 9:38:52 AM https://xxxx.sharepoint.com/sites/xxxx/Lists/xxxx...

DEBUG: [CmdletEndProcessing]: - Update-MgSiteListItem end processing.

as you can see in the body request the fields

"Processed": true,

"LastProcessDate": "2024-10-02T09:38:51Z",

are correctly updated, but in the http response

"Processed": false,

"LastProcessDate": "2024-10-02T09:38:03Z",

it seems that the update have been ignored.

does anyone know the reason of this?

Thanks

Lorenzo


r/MsGraphPowerShell • • Sep 16 '24

Question Intunes Automation

1 Upvotes

Hello there,

I was trying to automate our standard App configuration policy for managed home screen, but i dont seem to find the right command. Every command i tried to get the app configuration policy just gives back nothing, but i controlled more then once that the policy is there to read it.

Has anyone of u came across the same problem and know how to solve it?

Its the Policy wich is configured here (Note: Language is german): Microsoft Intune Admin Center>Apps>App-Konfigurationsrichtlinien (German)

I would guess in English it is: Microsoft Intune Admin Center>Apps>App-Configurationpolicy