r/GraphAPI • • Jul 24 '24

Getting Disposition stages for labels not working

1 Upvotes

I am beating my head against a wall. Does anyone have an explanation for the following:

Using https://graph.microsoft.com/v1.0/security/labels/retentionLabels/ I get a proper list of retention labels

Using https://graph.microsoft.com/v1.0/security/labels/retentionLabels/{retentionLabel-id} I get

"Internal error occured while calling AdminApi"

Using https://graph.microsoft.com/v1.0/security/labels/retentionLabels/{retentionLabel-id}/dispositionReviewStages I get

"{"Message":"No HTTP resource was found that matches the request URI 'https://substrate.office.com:444/complianceWorkbench/security/labels/retentionLabels('XXXXXXXXXXXXXXXX')/dispositionReviewStages'.","MessageDetail":"No type was found that matches the controller named 'retentionLabels'."}",

Using Powershell using Get-MgSecurityLabelRetentionLabel works to list the labels. Trying to access a specific label with Get-MgSecurityLabelRetentionLabel -RetentionLabelId "xxxxx" gets the same adminapi error as above.

The only result online I can find is this: https://learn.microsoft.com/en-us/answers/questions/1381375/unable-to-get-retention-label-by-id

It seems maybe the Graph API is just being left broken?


r/GraphAPI • • Sep 21 '23

b2cUserFlows removed from MS Graph API /identity ?

2 Upvotes

Hello

i had played around with Entra Exporter and noticed, that user data / flows from B2C are not exported / backed up. i had a look in the module and in Graph explorer and, for ver 1.0 and the beta, it was removed.

Instead there is now B2xUserFlows which, it self, do nothing.

github itselfs have no comments / updates for a while now for the projekt and actually i dont see currently any alternative to do it.

Am i missing something ?


r/GraphAPI • • Feb 06 '25

OneDrive Search Returns No Results when Switched to Application Permissions

1 Upvotes

I have developed a Python script to search for specific files in OneDrive using the Graph API. The goal is to search across multiple user accounts within my tenant. When developing the script I registered the app in Entra and used delegate permissions. Used the script to find files within my own OneDrive and it gets results.

Then I registered a new app in Entra that uses application permissions instead of delegate (same permissions: Files.ReadWrite.All, Sites.ReadWrite.All, User.Read.All), switched the app/client ID in my code, and generated a secret to use in ClientSecretCredential. The searches still run without error but no results are returned when I target my own OneDrive. If is switch back to the old client ID, the searches return results again. So it doesn't appear to be an issue with the code (see a shortened version of the code below).

On the API Permissions page I clicked "Grant admin consent for <tenant>" and all of the permissions show as "Granted".

What am I missing?

async def main(file_name: str, drive_id: str):
    # Initiate GraphClient
    secret = "<secret>"
    client_id = "<client_id>"
    tenant_id = "<tenant_id>"
    client_secret_credential = ClientSecretCredential(client_secret=secret, client_id=client_id, tenant_id=tenant_id)
    graph_scopes = ['https://graph.microsoft.com/.default']
    graph_client = GraphServiceClient(client_secret_credential, graph_scopes)
    # Run searches
    try:
        # Use Graph Search
        request = SearchRequest(
            query=SearchQuery(query_string=file_name),
            entity_types=[EntityType.DriveItem],
            region="NAM",
            share_point_one_drive_options=SharePointOneDriveOptions(
                include_content=[SearchContent.PrivateContent, SearchContent.SharedContent]),
        )
        post_request_body = QueryPostRequestBody(requests=[request])
        search_result_1 = await graph_client.search.query.post(post_request_body)
        # Use OneDrive Search With Q
        search_result_2 = await (graph_client
                               .drives
                               .by_drive_id(drive_id=drive_id)
                               .search_with_q(file_name)
                               .get())
    except APIError as e:
        print(f"Error when searching for OneDrive File {file_name}: {e.primary_message}")
        return None
    except Exception as e:
        print(f"Unknown error occurred when searching for OneDrive File {file_name}: {e.primary_message}")
        return None
    print(len(search_result_1.value))
    print(len(search_result_2.value))

r/GraphAPI • • Dec 05 '24

file uploads to a drive, restricting permissions

1 Upvotes

created a folder on sharepoint via Graph. however, i want to limit both visibility and access to the folder.

listing permissions on the folder, i can see owners, visitors, members of the site.

can i simply revoke all of those permissions (this is delegated permissions as a user), and then replace them with a user group? if i revoke the permissions can i still see the folder/contents as the user who created it via the delegated permissions?


r/GraphAPI • • Feb 05 '25

Subscription end dates

2 Upvotes

Hi all, has anyone found a way of extracting subscription/contract/agreement expiry dates?

/directory/subscriptions lists all of the unit counts for each license and includes nextLifecycleDateTime. However, this shows is misleading for monthly billed licenses. It appears that it is not accomodating NCE licenses.
How can I find whether a subscription is:
monthly billed / 1yr commit
annually billed / 1yr commit
annually billed / 3yr commit

And also find the true renewal date, not just the next billing date?

Thanks


r/GraphAPI • • Jul 18 '23

How to use Graph API to get the OneNotes of a private teams channel?

4 Upvotes

Using the https://graph.microsoft.com/v1.0/groups/{id}/onenote/notebooks graph api endpoint, I can get all of the oneNotes of the team, but it does not show any oneNotes from private channels.

Also trying the https://graph.microsoft.com/v1.0/sites/{id}/onenote/notebooks api but it always returns ,

SQLCopy

"message": "The OData query is invalid. The URI segment 'notebooks' is invalid after the segment 'notes'."  

Is there another endpoint or specific group I should be looking at to get the oneNotes for the private channel?

My end goal is to be able to copy the oneNote from one channel to another.


r/GraphAPI • • May 12 '24

What platform are using graph API with?

1 Upvotes

Besides PoweShell


r/GraphAPI • • Jul 26 '24

Delete emails tenant wide based on Subject/Sender

1 Upvotes

We are exploring Graph API capabilities where we can delete emails tenant-wide based on the subject/sender email address. We have tried PowerShell content search/purge and it works as expected but we need Graph API for automation.

Any insights?


r/GraphAPI • • Sep 26 '23

Working with Excessive Microsoft Graph API Permissions

Thumbnail self.cybersecurity
1 Upvotes

r/GraphAPI • • Mar 13 '24

Reporting upon Graph API usage

2 Upvotes

Looking through Entra ID and Defender, I've found several reports to determine user sign-in activity, application usage reports, etc. etc.

I have not been able to find a report that shows Graph API usage within an environment. To me, this seems like something all administrators should be monitoring closely. Have you guys' generated reports to determine usage of the Graph API?

I'd like to begin rolling out conditional access policies to further restrict API usage, but cannot without knowing current use cases first.


r/GraphAPI • • Apr 02 '24

To apply SiteDesign to a site

1 Upvotes

Is there a way in graph api to apply site design to a SharePoint site?


r/GraphAPI • • Feb 08 '25

Asked to deploy to devices but only given user names.

Thumbnail
reddit.com
1 Upvotes

r/GraphAPI • • Jul 25 '24

Issues creating Enrollment Restrictions

3 Upvotes

Hi there, i've recently noticed the endpoint to POST Enrollment Restrictions has stopped working when authenticating as an application.

Application has both of the required permission:
DeviceManagementConfiguration.ReadWrite.All
DeviceManagementServiceConfig.ReadWrite.All

This is my call:

POST https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations
{
  "@odata.type": "#microsoft.graph.deviceEnrollmentPlatformRestrictionConfiguration",
  "displayName": "TestAndroidRestriction",
  "description": "Some description",
  "priority": 0,
  "roleScopeTagIds": ["0"],
  "deviceEnrollmentConfigurationType": "singlePlatformRestriction",
  "platformRestriction": {
    "@odata.type": "microsoft.graph.deviceEnrollmentPlatformRestriction",
    "platformBlocked": false,
    "personalDeviceEnrollmentBlocked": true
  },
  "platformType": "android"
}

Error returned is a 401: "Tenant is not Global Admin or Intune Service Admin"

To make sure i'm doing excactly the same thing i tried authentication through PowerShell using MGGraph as a User (Global Admin) and an Application.
This works fine when authenticating as a user but as soon as i use an app it fails with the error.

Am i missing something here? The same code worked fine about 1-2 months ago.
I can't seem to find any mention of this here or on google and the "old way" of defining all restrictions at the same time is deprecated.


r/GraphAPI • • Jul 23 '24

Microsoft Graph API with OneDrive and SharePoint

4 Upvotes

I'm a beginner, never used graph API before, i just started interning at a company, they primarily use OneDrive and SharePoint for archiving their files. I was wondering if i could try to make the archives a bit more accessible for them, like adding filters and making them more easily searchable with reference numbers. Is that possible? And how can i go on about this? I haven't found many tutorials online that develop organizing programs for OneDrive and SharePoint


r/GraphAPI • • Oct 29 '24

Can I use either Microsoft Graph API or REST/PNP in SPFx to update a metadata column in a list item?

1 Upvotes

I've been trying to update a managed metadata (taxonomy) column in a SharePoint list item through SPFx, using both the Microsoft Graph API and REST/PNP approaches. I’ve tested various payload formats and methods that were suggested in forums and documentation, but nothing has worked so far. Has anyone managed to get either method working for this purpose, or is there another workaround that I’m missing? Examples or insights would be hugely appreciated! Thanks in advance.


r/GraphAPI • • Sep 10 '24

Trying to use Graph to pull user/device ownership for BI report

1 Upvotes

HR requested a report showing all users whom have registered devices under their account. Trying to leverage PowerBI/Fabric to tap into graph and pull tables that have enough data to associate a device (or multiple devices) with a user for compensation purposes. Anyone here have any ideas on the matter? I can pull devices and I can pull users, but I do not have any clue as to a way to associate them without running graph calls against specific device IDs or user principal names.


r/GraphAPI • • Aug 20 '24

Universal Print Graph API (Application Permissions)

2 Upvotes

I want to leverage an application to query things related to Microsoft Universal Print.  

The application has the permission: Printer.ReadWrite.All  

But every call listed in the Microsoft documentation regarding the Print API states that Application permissions are not supported.

Why make a permission that is not supported anyways?

Can anyone tell me if it's possible to use Graph with application permissions to request printer usage?


r/GraphAPI • • Oct 22 '24

SharePoint API Doesn't Return All Available Sites

1 Upvotes

I have a SharePoint site called 'NetSuite BluDocs' in which there is a group called 'NetSuite BluDocs Members'. The folders within the 'NetSuite BluDocs' site are displayed in an implementation of Oracle's NetSuite using a third-party Suitelet called 'bluDocs'. All users must authenticate their bluDocs, which just asks SharePoint for a user-specific key.

When a user opens a project in NetSuite, the bluDocs section will establish a connection to SharePoint using the key, then will retrieve a list of sites that the user is allowed to look at (using https://graph.microsoft.com/v1.0/sites?search=). Every user is in the 'NetSuite BluDocs Members' group, which is an 'Edit' group. However, the 'sites' API is NOT returning the name/URL info for 'NetSuite BluDocs' in the JSON for a handful of users even though it returns every other site the user has access to.

Note that every user can go to the actual SharePoint site and see everything they need to see. The problem within NetSuite is caused by the 'sites' API not returning the 'NetSuite BluDocs' site.

If our users are all in the 'NetSuite BluDocs Members' group for the 'NetSuite BluDocs' site, what would prevent the 'sites' API from returning the 'NetSuite BluDocs' site information for a handful of users when it works correctly for every other user?


r/GraphAPI • • Sep 13 '23

On-Demand appointment via Bookings

3 Upvotes

I've successfully been able to create new scheduled appointments via the Microsoft Bookings API in Microsoft Graph, and when I look at my Virtual Appointments queue I see them in the "Scheduled" section.

However, I need to be able to create On-demand appointments as well. So far I haven't been able to discover the right way to do that. I can create a meeting via the onlineMeeting API, but that doesn't actually put anything into the On-demand queue.

What am I missing here? What is the proper way to create an On-demand appointment? I don't think it can be done via the Bookings API.


r/GraphAPI • • Oct 24 '24

Cannot add users to mail-enabled groups using Zapier

1 Upvotes

Hello everyone, I've been trying to automate the onboarding process for my company but GraphAPI doesn't seem to be supporting user addition to mail-enabled groups.... Do you guys know any workaround for this?


r/GraphAPI • • Sep 27 '24

AutopilotDeviceIdentity Search by Serial

1 Upvotes

I am trying to search the list of devices in the windowsAutopilotDeviceIdentities list by serial. In the docs it just shows you can search by the ID, is there a way to search by a devices serial? Thanks for your help!


r/GraphAPI • • Nov 27 '23

How to get url of shared media from Instagram Inbox

5 Upvotes

I'm trying to grab the url of an instagram post/story that has been sent to my inbox with the Graph API. I'm receiving text and other attachments like images and videos correctly. When I perform a GET request with a message ID of a message that contains shared media like a post or story, the attachments and shares object is empty. I can get most of the other fields in this list: https://developers.facebook.com/docs/graph-api/reference/message but for some reason attachments and shares are always empty when the message is a shared post/story.

All I want is the url of the shared post/story, like the one you get when you Copy Link from a post/story in the Instagram App. Something like: https://www.instagram.com/p/Cz91G2aA-k2/?utm_source=ig_web_copy_link

Here is the query I'm putting into Graph API Explorer: GET/v18.0/{message-id}?fields=attachments,shares

All I get returned back is the message ID.

I've tried a number of solutions to get the correct url, including setting up webhooks. The closest I got was getting the url of the image/video asset in the payload of the webhook response. (Something like: https://lookaside.fbsbx.com/ig_messaging_cdn/?asset_id=17985658535528245&signature=AbwzHB15sNyHStYZZmw3_cHMyb0a61k6753z6HaTVbGHvLYbqO1kT8bpzbTGLpJGVyjAo-GOkYUyvA-VwKAF_PipEZmwq41IKrlkrZqwqYxGp583CuviMCML3EklKc3wIwCH2mbi47gm4zd_k0c0mcHPWgBmnWUvA0txK6tqTOmB6Zxs3TxiAaIpyDSMCWkovE5ZCrRGjklraueJasPWq2ZVW9DfHeJR)

But I want the link for the post itself, not just the image/video asset.

Is this even possible? Thanks for the help!


r/GraphAPI • • Oct 15 '24

Connect-MgGraph -UseDeviceCode does not prompt MFA

1 Upvotes

I am investigating different Microsoft Entra ID sign-in mechanisms to confirm the effectiveness of Microsoft Graph API with MFA. While Connect-MgGraph cmdlet itself and alongside many other flags like "-TenantId" prompted for MFA, the Connect-MgGraph -UseDeviceCode does not prompt for MFA. 

 

The question would be "Are you sure MFA has been configured on your Azure Tenant?" Well, Good question. The answer will be "It is only the use of -UseDeviceCode that is failing to prompt the MFA. So something is quite wrong other than MFA setup on our Azure.

 

Is this something someone has also witnessed? 


r/GraphAPI • • Nov 14 '24

All emails sent via Graph from sandbox tenant are rejected by receiving

2 Upvotes

I'm developing a .NET application that needs to create and send email messages via the Graph API. That part is all working fine. However all emails created this way are rejected by the recipient:

Your message was rejected by the recipient email server. Please check the recipient's email address and try resending your message, or contact the recipient directly. For more tips to help resolve this issue, see DSN code 5.1.0 in Exchange Online - Office 365. If the problem continues, contact your email admin.

The domain is via the Azure Developer Sandbox i.e. of the form blah.onmicrosoft.com. If I go to outlook.com and log in as one of the test users that is created with the sandbox, I can create and send a mail successfully.

Regarding DMARC, SPF and so forth - I assume that is all set at the onmicrosoft.com level. So why is it failing ?