r/GraphAPI • • Oct 28 '22

Logic App Using Graph API to get Drive File Contents

2 Upvotes

In order to use Managed Identities in our logic app we are using Graph API. Everything is working great, (moving files from email to SharePoint Doc Lib, uploading files from on-prem into SharePoint, etc.) however I can't seem to figure out how to get the contents of a file in the JSON response of the body. Everytime I append "/content" to the end of the URL it tries downloading the file. I'm looking for a way to get the contentBytes returned in the body of a JSON response like I do when I get attachments of emails. The HTTP graph API call in the logic app gets a 302(redirect) because it tries downloading the file. I can't find anything that helps me in the Microsoft Graph API documentation either, if anyone has any information that could help me get the byte contents as a JSON response that would be great, thanks!


r/GraphAPI • • Jun 26 '22

get adfs Service health

1 Upvotes

Hey guys,

Iam building a powerapp which shows the status of all connectors and certificates of azuread, intune, proxies and so on.

Is there a possibility to get the Status of the adfs connector with graph? I cant find anything 😒


r/GraphAPI • • Nov 09 '22

Attendance Reports for Channel Meetings?

1 Upvotes

Hi everyone!

https://learn.microsoft.com/en-us/graph/api/onlinemeeting-get?view=graph-rest-beta&tabs=http

Might sound like a silly newbie question, but would this work for meetings in channels?

I have seen other entries that do not enable that, but this one does not specify if this method enables me to get some sort of attendance out of Channel meetings.

Does anyone have some experience with this? What connectors would you use in power automate, if you use it?


r/GraphAPI • • Feb 20 '23

Error when creating subscription to change notifications

2 Upvotes

I am currently working on a project in Zoho Deluge language. When I an trying to subscribe to change notifications, I am facing an error saying

"error": {

  • "code": "InvalidRequest",

  • "message": "Subscription validation request failed. Response must exactly match validationToken query parameter."
    }

I am passing the exact parameter that I am getting as response, but it still shows this error.How can I solve this issue?


r/GraphAPI • • Feb 04 '22

403 on Invote-WebRequest

2 Upvotes

Good evening everyone,

I am trying to run a PowerShell script that connects to the GraphAPI to get OneDrive users who have shared folders: https://github.com/michevnew/PowerShell/blob/master/Graph_ODFB_shared_files.ps1

I keep getting a 403, but I have the following API permissions set:

  • sites.readwrite.all

  • user.read

  • user.read.all

I know I am missing some kind of permissions based on the error message, but I am not sure what.

Any help is appreciated,

Hyde


r/GraphAPI • • Oct 13 '22

Unified Group Create / Modify - SMTP Address (PowerShell)

3 Upvotes

Hello - I am creating some powershell scripts for my company to automate the creation of some Microsoft 365 "Unified" Groups. I have no issues creating the group through powershell, but I need to modify the SMTP address to be on a subdomain already registered within our Microsoft Tenant. I see the Mail and ProxyAddress fields are read only fields.... Is there a way with Graph API to modify the email address or add a new one through powershell?

For reference, I am using the New-MgGroup, and I also tried the Update-MgGroup commands. Thanks in advance for any help!


r/GraphAPI • • Jan 27 '22

Help with Get-MgUser (Graph SDK)

Thumbnail self.powershell
1 Upvotes

r/GraphAPI • • Feb 07 '23

assignLicense for devices?

2 Upvotes

Have gone through the Graph API reference list and seems you can only assign licenses for users? How about devices? There are several Azure AD Licenses that are device based.

POST https://graph.microsoft.com/v1.0/users/UPN/assignLicense


r/GraphAPI • • Feb 25 '22

Application Authentication/Permissions

2 Upvotes

Hello! I'm trying to develop an application that consumes the calendar API of multiple users and the permission/authentication process confuses me.

The idea is that the users give read/write permissions of their calendars to the system once and from there the backend can make requests without the user intervention.
But I don't fully understand the authentication flow, Graph generates and returns a permission token that the system can save and reuse at anytime? Should I store the refresh_token?

Sorry if the question is confusing, english is not my first language.
Thanks and good weekend.


r/GraphAPI • • Apr 05 '23

Azure app registration with user consent

3 Upvotes

Today I have an single-tenant Azure App registration / Enterprise app setup with admin consent in my customers AD which gives me permission to get data (calendar events) from all users in the AD.

What I'd like is to have a multi-tenant app in my own AD and then give relevant customer users the option to subscribe to the AD-app, so that I can get data from only the users that consent.

Can anyone guide me in the right direction? Maybe a tutorial that shows both the AD-app settings and C# code examples.

Thanks.


r/GraphAPI • • Feb 10 '23

Get-MgUser SignInActivity not working

3 Upvotes

Hi Reddit,

I'm trying to get last sign in date for all users in a tenant but I'm having some problems doing this with PowerShell.

Using latest PowerShell 7.3.2 and the Microsoft.Graph.Users 1.21.0 module. PowerShell returns a bunch of empty results, shown in image 1. Commands I'm running:

Connect-MgGraph -Scopes "User.Read.All","AuditLog.Read.All"
Select-MgProfile -Name "beta"
Get-MgUser -UserId "<upn>" | select -ExpandProperty SignInActivity

On the Graph Explorer site I can get this data for all users when logged in with the same account and granting the same permissions.

I also see some examples on the internet using Get-MgUser -UserId "<upn>" -Property SignInActivity but when I try this (and switch to using the account id, not upn) it doesn't display this property at all. Shown in image 2.

What am I doing wrong?

Thanks!


r/GraphAPI • • Jan 27 '22

Using Date Filter on Graph API query

Thumbnail self.powershell
1 Upvotes

r/GraphAPI • • Jun 20 '23

Least permission setup with Graph

2 Upvotes

Hi guys,
We have an AAD connector that needs to be able to see users, groups and computers for an organization. It's currently set up with the Directory.Read.All permission - but I'm wondering if this is strict enough.
The Microsoft documentation isn't all that helpful as it just states that " Allows the app to read data in your organization's directory, such as users, groups and apps."
Would it be more correct to set our app up with Users.Read.All, Devices.Read.All and Groups.Read.All - or does this actually cover exactly what the Directory.Read.All does?

Thanks a lot :)


r/GraphAPI • • Apr 03 '23

Azure enterprise app - set Linked-based signon-url via powershell?

2 Upvotes

looking to do this https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/configure-linked-sign-on

but via powershell, graph SDK. or even graph api. does anyone know how to set this value? nothing online that i can find


r/GraphAPI • • May 25 '22

Outlook Contact Creation Converting Hashtable Params to Objects?

2 Upvotes

I'm testing out Microsoft Graph API PowerShell to copy Outlook personal contacts from one user to another. My script looks like this:

$contacts = Get-MgUserContact -UserId [email protected] -property * -top 300 | select *

foreach ($user in $contacts) {
$params = @{
GivenName = $contacts.givenname
Surname = $contacts.surname
MobilePhone = $contacts.MobilePhone
Jobtitle = $contacts.JobTitle
CompanyName = $contacts.CompanyName
Categories = $contacts.Categories
NickName = $contacts.NickName
EmailAddresses = @(
@{
Address = $contacts.surname+$contacts.GivenName[0]+'@company.com'
Name = $contacts.displayname
            }
        )
    }
New-MgUserContact -UserId [email protected] -BodyParameter $params
}

For all the attributes like display name or email it converts it to an object: {System.Object[]}

When i do $params.givenname | gm it says that it's a system string, so I'm unsure why it tries making it an object.


r/GraphAPI • • Mar 29 '22

Anyone found good examples using the Powershell Module for Graph API of creating a holiday file?

2 Upvotes

I'm more familiar with powershell, so I've starting playing with the PS module for graph API and then following this example, I have created a single calendar event on a test calendar: https://docs.microsoft.com/en-us/graph/api/calendar-post-events?msclkid=bc9d16dfafaa11ec9d6355fdb079060e&view=graph-rest-1.0&tabs=powershell

What I'm trying to learn how to do is to use this method to create a process to add national holidays and paydays to users calendars. I'm getting stuck moving away from the example (a meeting with a specific date/time frame 'start' and 'end' and moving to 'isallday'.... anyone done something like this with a series of unique events?


r/GraphAPI • • Apr 22 '23

Compliance assessments

2 Upvotes

I am trying to find some way to access the compliance reports and assessments in purview. I have seen a few very very short learn articles that may imply that are there, but I can't find them.

My goal is to integrate our doc as code + OSCAL models to populate the compliance narratives in purview. (And vice versa, Microsoft met controls into OSCAL documents.


r/GraphAPI • • May 15 '23

Send Chat message to MS Teams as Important?

1 Upvotes

Hi,
I'm trying to set-up a Power Automate flow which forwards important emails to an MS Teams private chat - which is supposed to notify me with a mobile push notification when a certain important email arrives.
I noticed that the only way to bypass the quiet time and send a notification to a user is via sending an important / urgent message to that user in a private chat, teams and channels do not send a push notification.
My question is:
Is it possible to forward emails as a private message to a user with an automated API flow, and have the messages flagged as 'important'?
Power Automate does not have the option to do so, sending normal messages works fine, but I haven't found a way to flag those messages as important or urgent.

Thanks!


r/GraphAPI • • Jan 29 '23

Create Mail Folder

2 Upvotes

Hello All,

I am trying to create a MailFolder within a folder using the Graph API. I can get it to create it in the root using the documentation below, but is there a way to get it to create a folder within a folder?

https://learn.microsoft.com/en-us/graph/api/user-post-mailfolders?view=graph-rest-1.0&tabs=http

Many thanks!


r/GraphAPI • • Dec 02 '22

Access denied for Groups

2 Upvotes

I am attempting to use Graph Client to get groups and members. I have the application set up in AD with the proper permissions. However, when I attempt to get the groups, it comes up with access denied. The code works when I use a user Id to get emails. The code to get the client is:

            var scopes = new string[] { "https://graph.microsoft.com/.default" };

            IConfidentialClientApplication confidentialClient = ConfidentialClientApplicationBuilder
                .Create(clientId)
                .WithClientSecret(secretValue)
                .WithTenantId(tenantId)
                .Build();

            // Retrieve an access token for Microsoft Graph (gets a fresh token if needed).
            var authResult = await confidentialClient
                    .AcquireTokenForClient(scopes)
                    .ExecuteAsync().ConfigureAwait(false);

            var token = authResult.AccessToken;

            GraphServiceClient graphServiceClient =
                new(new DelegateAuthenticationProvider(async (requestMessage) =>
                {
                    requestMessage.Headers.Authorization =
                            new AuthenticationHeaderValue("Bearer", token);
                })
                );

The code to get groups is simple:

 var groups = await graphClient
                    .Groups
                    .Request()
                    .GetAsync();

The permissions have been granted to the application:

What am I doing wrong?


r/GraphAPI • • Jan 27 '22

Question regarding Powershell and Microsoft Graph API calls

Thumbnail self.powershell
2 Upvotes

r/GraphAPI • • Jan 10 '23

Is there a way to check if a user has access to certain groups without having the correct access packages assigned?

2 Upvotes

Hi guys

I'm currently looking into case for a client where they'd like to check if there are users that have access to certain AD Groups without the proper assigned Access Packages.

I've been looking everywhere at AssignmentPolicies, AssignmentRequests, Access Package Resources, but the main thing that eludes me is how to connect Access Packages and Groups.

Is this doable? Anyone that's already done this?

Thanks!


r/GraphAPI • • Dec 23 '22

Microsoft Graph Group Delta

2 Upvotes

Hey Guys,

Is is possible to get changes(user added/removed) to an ad group using Microsoft graph delta query? if yes can anyone share powershell script to get the information?

Thx,PRS


r/GraphAPI • • Jan 27 '22

Graph API List all Subscriptions in tenant

Thumbnail self.powershell
1 Upvotes