Problem copying file in SharePoint with Ms Graph v5.x
Hello. I need to copy a file in SharePoint, with Ms Graph v5.61 to a new folder (in the same library). The problem is that it copies but the process does not wait for it to complete and returns null, then I check and the file exists. I pass the code that I am using. public async Task<string?> CopyAsync(string listDriveId, string sourceDriveId, string destinationDriveId, string newName) { try { GraphSDK.Drives.Item.Items.Item.Copy.CopyPostRequestBody destinationInfo = new GraphSDK.Drives.Item.Items.Item.Copy.CopyPostRequestBody() { ParentReference = new ItemReference() { DriveId = listDriveId, Id = destinationDriveId }, Name = newName }; DriveItem? copy = await _graphClient.Drives[listDriveId].Items[sourceDriveId].Copy.PostAsync(destinationInfo); // Problem: "copy" is always null, but it is copied. When I check if the copied file exists, this file exists. if (copy != null) { return copy.Id; } } catch { } return null; } Can you help me? Thank you very much.6Views0likes0CommentsPowerApp Graph Custom Connector without User Login
So I've been trying to create an app that will allow users to set and edit their own pronouns and then store those pronouns in Graph for use in Email Signatures and the such. I've been following this tutorial <How to add Azure AD directory extensions> in doing so, and I've basically got it down I've made the app and it works. However, it only works for me, i.e. admins. Whenever another user logs in and they are able to view their pronouns, i.e. GET graph.microsoft.com/me, but can't update their pronouns, PATCH graph.microsoft.com/me?$select=pronouns They get this error: My question is what can I do to get this app to be able to make the changes to this one specific item in graph, or allow for users to be able to edit this for themselves, or something that would make this work. Or perhaps I'm going about it the wrong way. Any help is appreciated, Kamala17Views0likes1CommentTeams: adding users through teams or groups
Hi there, I'm in the progress of making a coupling between our SIS (school information system) and Teams us MS Graph. In the past we used SDS for that, but that is going into a direction we don't like. Not the discussion for now. This is: Currently at the point where I have to make adecision on how to add owners/members to the teams I create. Teams being specialized groups I seem to have 2 options: - with the groups add member/owner option (Add members - Microsoft Graph v1.0 | Microsoft Learn) - with the teams add member/owner option (Add member to team - Microsoft Graph v1.0 | Microsoft Learn) It seems that by adding them through the groups option there can be a 24 hour delay before the user is actually added to the team, and one of the team users will have to have been online in the Teams desktop app. A bit of a hazzle it seems. Reading that I'm inclined to add them using the teams method. But are there other consideration that I'm missing? Peter215Views0likes1CommentDeviceID against Signed in user.
Hi all, Some of our devices aren't against the correct user in Intune. Therefore, I'm looking for a way to find the device last signed in user. I can see from a User and which devices they've used. (But I want the other way around). Thanks in advance!295Views0likes0CommentsRetrieve over 28 days of teams call data
Hi, I'm writing a powershell script that is using graph API to retrieve call data from Teams older than 28 days. The Error I get is: Invoke-RestMethod : The remote server returned an error: (404) Not Found. At C:\VSSource\Teams scipt\Teamsdata2.ps1:40 char:13 + $Response = Invoke-RestMethod -Method Post -Uri $APIUrl -Headers $Hea ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodComma nd The script I have written is (I have removed Tennat ID, Client ID etc) # Set your tenant ID, client ID, and client secret $TenantId = " " $ClientId = " " $ClientSecret = " " # Constants and endpoint URLs $Authority = "https://login.microsoftonline.com/$TenantId" $Resource = "https://graph.microsoft.com" $Scope = "https://api.interfaces.records.teams.microsoft.com/Teams.VoiceAnalytics" $GrantType = "client_credentials" $AuthTokenUrl = "$Authority/oauth2/token" $APIUrl = "https://api.interfaces.records.teams.microsoft.com/Teams.VoiceAnalytics/getanalytics" # Calculate the date 28 days ago $Date28DaysAgo = (Get-Date).AddDays(-28).ToString("yyyy-MM-dd") # Generate the access token $TokenBody = @{ grant_type = $GrantType client_id = $ClientId client_secret = $ClientSecret resource = $Resource scope = $Scope } $AccessToken = (Invoke-RestMethod -Method Post -Uri $AuthTokenUrl -ContentType "application/x-www-form-urlencoded" -Body $TokenBody).access_token # Set request headers $Headers = @{ 'Authorization' = "Bearer $AccessToken" 'Content-Type' = "application/json" } # Create the request body $RequestBody = @{ startTime = $Date28DaysAgo + "T00:00:00Z" endTime = (Get-Date).ToString("yyyy-MM-dd") + "T23:59:59Z" } | ConvertTo-Json # Make the API call $Response = Invoke-RestMethod -Method Post -Uri $APIUrl -Headers $Headers -Body $RequestBody -ContentType "application/json" # Save the data to a CSV file $Response.values | Export-Csv -Path "CallData.csv" -NoTypeInformation # Display a message when complete Write-Host "Call data exported to 'CallData.csv'"1.4KViews0likes1CommentIssue Creating InTune Compliance Notification
Hi, complete Graph newbie here trying to learn the ropes. Currently using the Graph explorer to get comfortable. We're an MSP, so we set up a lot of InTune tenants for customers and currently do it manually, I'd like to automate a lot of it which I've done with regular old PowerShell, but some of it seems to be restricted to the (better) Graph. Currently, I'm usinghttps://learn.microsoft.com/en-us/graph/api/intune-notification-notificationmessagetemplate-create?view=graph-rest-1.0&tabs=http and https://learn.microsoft.com/en-us/graph/api/intune-notification-localizednotificationmessage-create?view=graph-rest-1.0&tabs=http To try and create a POST request to:https://graph.microsoft.com/v1.0/deviceManagement/notificationMessageTemplates This is what I have: { "@odata.type": "#microsoft.graph.notificationMessageTemplate", "displayName": "Your Template Name", "defaultLocale": "en-us", "brandingOptions": "includeCompanyLogo", "localizedNotificationMessages": [ { "@odata.type": "#microsoft.graph.localizedNotificationMessage", "locale": "en-us", "subject": "Your Notification Subject", "messageTemplate": "Your Notification Message", "isDefault": true } ] } In the request body using Graph explorer. A lot of values are place holders but they should still create just to test. Initially I was getting errors with the payload but have fixed those. Now, no matter how much modifying I do, I always get this as 400 bad request error: { "error": { "code": "BadRequest", "message": "{ \"_version\": 3, \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 2e3410e5-8f41-8b2f-755c-f42d2944e26d - Url: https://fef.msub07.manage.microsoft.com/StatelessNotificationFEService/deviceManagement/notificationMessageTemplates?api-version=5018-07-01\", \"CustomApiErrorPhrase\": \"\", \"RetryAfter\": null, \"ErrorSourceService\": \"\", \"HttpHeaders\": \"{}\"}", "innerError": { "date": "2023-11-10T14:24:35", "request-id": "efbf0aae-23bf-445f-83e8-141c3d0e7255", "client-request-id": "2e3410e5-8f41-8b2f-755c-f42d2944e26d" } } } Could anyone help me identify what's wrong, or point me where I can learn more? Thank you so much.442Views0likes0CommentsCustom Mail forwarding via Graph API
Hi, we use EWS to create custom rules for diff. users including mail forwarding rules. EWS is going to be shut down for 3rd Party apps, so we need to use Graph. I only found how to set out of office rules via Graph but I'm missing an option for custom mail forwarding rules?!? Can anyone help?460Views0likes1CommentHow to define source IPs from Microsoft Graph service?
Hi, We need to setup MS Graph webhooks to points to our end points on our own servers. Question is., how this session could be hardened? Microsoft has published these network lists:Microsoft 365 Common and Office Online And on the ID 56, there is the following subnets: 20.20.32.0/19, 20.190.128.0/18, 20.231.128.0/19, 40.126.0.0/18, Are these the source IPs for what Graph is using? Or is it the other site Microsoft has published:Other endpoints not included in the Office 365 IP Address and URL Web service On there they have ID 23Microsoft Graph Change Notifications. And tons of networks 😄 Also, when the connection is established from Graph to our servers, is there a way to identify the traffic on the header level? E.g. can I set certain GUID which will be always used? Is there something else what should be taken care?848Views0likes0CommentsPossible to call an additional endpoint after query parameter?
Hi, I'm relatively inexperienced with the Graph API. I have a query returning a user by using the $search query paramter: /v1.0/users/?$search="displayName:Test" This works as intended. However, ultimately, I would like to get this user's manager. So how do I write the query? I tried adding another endpoint (is /manager called an endpoint?): /v1.0/users/?$search="displayName:Test"/manager But this throws the error: Syntax error: character '/' is not valid at position Is it not possible to do that in one call? Thanks for your help.430Views0likes0Comments