msgraph
10 TopicsPin a message in a channel in MS Teams using MS Graph API
I've created a MS Teams app and as part of it's functionality, it has to pin the message (in both one-on-one chat and in a channel) on behalf of the user I'm using below API to pin a message in a channel in MS Teams https://graph.microsoft.com/v1.0/chats/19:....@thread.tacv2/pinnedMessages Endpoint: - POST https://graph.microsoft.com/v1.0/chats/19:....@thread.tacv2/pinnedMessages Body: { "email address removed for privacy reasons": "https://graph.microsoft.com/v1.0/chats/https://graph.microsoft.com/v1.0/chats/19:....@thread.tacv2/pinnedMessages/messages/<message_id>" } Note: - https://graph.microsoft.com/v1.0/chats/19:....@thread.tacv2/pinnedMessages is the chatID of the channel And I get a successful response as below 201 Created { "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#chats('19%3.......%40thread.tacv2')/pinnedMessages/$entity", "id": "<message_id>" } But when I go that particular channel, I don't see the message as the pinned message in the channel But when I try to get the list of pinned message in a channel using below API, it gives the response that the above message which I pinned. But I don't see it in the channel in MS Teams. And I'm facing this issue only while pinning the message in the channel using MS Graph API. I don't face the same issue with one-on-one chat with the bot I've created.92Views0likes1CommentHow to get teams channel message from reply of a message id in ms graph?
Hi, I'm currently using the Microsoft Graph API to develop an app. I use https://graph.microsoft.com/v1.0/search/query to search for messages. I receive the results, which include both the original message and reply message. I want to use the message ID to retrieve the detailed message using this API: /teams/{team-id}/channels/{channel-id}/messages/{message-id}. If the message is the main message, it returns the details. However, if it's a reply, it returns a 404 error. Does this mean I need to obtain the main message ID from the reply? Is there any API or practical way I can use to retrieve it? Thank you!280Views1like3CommentsPossible bug with getting Special Folder query
Hello, Based on the https://learn.microsoft.com/en-us/graph/api/drive-get-specialfolder?view=graph-rest-1.0&tabs=http I can perform the following query to get data about a certain Special folder in OneDrive. It works perfectly if I query myself: https://graph.microsoft.com/v1.0/me/drive/special/documents However, if I enter an actual "userId"https://graph.microsoft.com/v1.0/{userId}/drive/special/documents I'm getting data from a shared site, instead of my personal. {me}: https://contoso-my.sharepoint.com/personal/alex_growtek_contoso_com/Documents/Documents {userId}: https://contoso.sharepoint.com/Shared%20Documents/Documents Is it a bug? As I couldn't find the way to fix that.262Views0likes0CommentsGraph API deleted user attributes and searching / filtering
Is there a way to search deleted users by attributes with the Graph API? If so, which attributes are searchable? If I need to restore an account that I don't have the id / objectid for, I have to retrieve all deleted users and then filter the results. Also, is there a way to retrieve the onPremisesImmutableID and the lastDirSyncTime of a deleted user that was federated with AzureADConnect?527Views0likes0CommentsIssues with POST to GraphAPI with Powershell
I can export Intune policies using the API so i know i'm authenticated but when I try to POST one of the policies i get a response but its just a repeat of the JSON file and no Error or 201 success message. Invoke-RestMethod -Uri https://graph.microsoft.com/Beta/deviceManagement/deviceCompliancePolicies -Headers $global:authToken -Method POST -Body $json_output -ContentType "application/json" If i take the JSON file and paste it in to the body of MSGraph Explorer it works but i'm not sure why i'm not getting a response back.369Views0likes0CommentsCalling principal does not have required MSGraph permissions AuditLog.Read.All
I have a Runbook (Automation Accounts) parsing AAD SignIn and Audit logs, however, when it executes Get-AzureADAuditSignInLogs I'm getting the following error: Get-AzureADAuditSignInLogs : Error occurred while executing GetAuditSignInLogs Code: Authentication_MSGraphPermissionMissing Message: Calling principal does not have required MSGraph permissions AuditLog.Read.All The Managed Identity I'm using in Runbook has Security Reader role, but it doesn't seem to be enough?Solved18KViews0likes6CommentsAPI doc for msgraph deviceGeoLocation and hardwareInformation does not mention url path
I am trying to integrate intune api with my application. The API doc for msgraph deviceGeoLocation (https://learn.microsoft.com/en-us/graph/api/resources/intune-devices-devicegeolocation?view=graph-rest-1.0) and hardwareInformation (https://learn.microsoft.com/en-us/graph/api/resources/intune-devices-hardwareinformation?view=graph-rest-beta) does not mention url path for the resource. I have tried a few url paths as a gues but I got 400 /deviceManagement/managedDevices/{id} and I got data /deviceManagement/managedDevices/{id}/deviceGeoLocation -> 400 Unsupported (both 1.0 and beta) /deviceManagement/managedDevices/{id}/hardwareInformation -> 400 Unsupported (beta) Please suggest what url paths must I use to get these resources559Views0likes0CommentsHow to set default Profile Picture Instead of FirstName & LastName Initials?
When I am trying to REMOVE user image from MS Teams, it is replacing the user image with the FirstName & LastName Initials image and I am getting the same image from MS Graph endpoint. Question: 1. Is there any way to set default user placeholder image instead of Initials? 2. Is there any MS Teams administrator setting that can not set the initials as a default user profile image.5KViews0likes3Commentsuploading local files from file share to SharePoint Online using MSGraph
Hi There, I am desperately searching for any blog or any article that explains the steps about how to upload local file share documents to SharePoint Online using MSGraph through a c# console application. Thank you so much for your help.. As of now i am using this code below to upload files using a PUT call. the code executes fine without error but when i open the file in SharePoint Online i get error stating "Sorry, this document cant be opened for editing". can anyone help me here please? public async Task CallWebApiAndProcessResultASyncFileUpload(string webApiUrlFileUpload ,string accessTokenFileUpload) { using (HttpClient client = new HttpClient()) { //String requestURI = webApiUrlFileUpload; //HttpContent httpContent = new StringContent("This Message is posted from Visual Studio Lab", Encoding.UTF8, "text/plain"); //HttpRequestMessage newPostRequest = new HttpRequestMessage(HttpMethod.Put, requestURI); //newPostRequest.Content = httpContent; //newPostRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessTokenFileUpload); //var newResponse = await client.SendAsync(newPostRequest); //var theResponseString = await newResponse.Content.ReadAsStringAsync(); String requestURI = webApiUrlFileUpload; var path = @"C:\Users\Name\Desktop\TestDoc.docx"; var multiForm = new MultipartFormDataContent(); FileStream fs = File.OpenRead(path); multiForm.Add(new StreamContent(fs), "file", Path.GetFileName(path)); HttpRequestMessage newPostRequest = new HttpRequestMessage(HttpMethod.Put, requestURI); newPostRequest.Content = multiForm; newPostRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessTokenFileUpload); var newResponse = await client.SendAsync(newPostRequest); var theResponseString = await newResponse.Content.ReadAsStringAsync(); } }1.2KViews0likes1CommentHow to create an <img> tag containing MSGraph photo/$value response BLOB
I'm creating a Sharepoint Application (using Shrepoint Framework) and I'm not being able to retrieve the Pohto BLOB returned when calling MSGraph "/me/photo/$value" api. I don't know how to convert the BLOB into a Base64 string. I know that the responseraw.body is a readable stream, but don't know hot to access it and use as a SRC of a IMG tag. I have made many attempts, I'm writing one to explain what I'm trying to accomplish: this.context.msGraphClientFactory .getClient() .then((client: MSGraphClient): void => { client.api('/me/photo/$value') .get((error, response: any, rawResponse?: any) => { const blobUrl = window.URL.createObjectURL(rawResponse.body); document.getElementById("myPhoto").setAttribute("src", blobUrl); }); }); This code fails because creteObjectURL has been deprecated. The MSGraph call works, but I can't process the response. Any suggestions?1.2KViews0likes1Comment