Microsoft Graph API for Azure AD B2C - azure

I am trying to access MS Graph API for updating user details.
I am using below but the filter criteria doesn't seem to work
PATCH https://graph.microsoft.com/v1.0/users?$filter=eq(extension_ce64b1571f694b84aeef256f85b7f49c_custom 'ABCD')
I am getting below error.
{
"error": {
"code": "BadRequest",
"message": "Invalid filter clause",
"innerError": {
"date": "2020-08-18T18:28:26",
"request-id": "5bbdc288-02b5-4b80-9ef4-707c12b7af47"
}
}
}
Updating by objectid is not an option and we need to use the custom attribute.
Please help.

The filter syntax in your request is incorrect. Please try below request which will fix your issue,
https://graph.microsoft.com/beta/users?$filter=(extension_f03e52a0a21349eebc055bbd0c920c0d_FavouriteSeason eq 'summer')

Related

List custom created directory roles programmatically

I created some custom directory roles with specific permissions. I have to list these custom roles in a programmatic way.
This gives list of all directory roles in Graph
https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions
Attempted changing query with filter but throwing Bad Request
https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=isBuiltIn eq 'false'
{
"error": {
"code": "BadRequest",
"message": "Invalid filter clause",
"innerError": {
"date": "2022-12-07T04:25:04",
"request-id": "09f4f286-8088-4a17-881b-584377fe8c58",
"client-request-id": "638047c0-e1e5-40e0-b166-416aacd1cc6a"
} } }
I tried to reproduce the same in my environment and got below results:
In Azure Portal, I applied filter with Type: Custom and got custom directory roles as below:
To get this list from Graph API, I ran the same query as you and got same error as below:
GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=isBuiltIn eq 'false'
Response:
To resolve the error, I modified the query and got the results successfully like below:
GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=(isBuiltIn eq false)&$select=displayName,id,isBuiltIn
Response:

Getting error while creating online meeting using graph api

Here i am using Microsoft graph api for creating online meeting events but after generating toke when i am requesting to create an online meeting i am getting this error
{
"error": {
"code": "ResourceNotFound",
"message": "User not found",
"innerError": {
"date": "2021-09-01T17:54:57",
"request-id": "fa773652-e824-4c9e-af05-085e249fb489",
"client-request-id": "fa773652-e824-4c9e-af05-085e249fb489"
}
}
}
enter image description here
Based on the So thread reference,
Use Delegated permissions to create an onlineMeeting
You must log in as a user, and you cannot use the client credential flow. You need to use the auth code flow to obtain the token.
Ref link - Delegated Permission: https://learn.microsoft.com/en-us/graph/api/application-post-onlinemeetings?view=graph-rest-1.0&tabs=csharp
SO Reference: 404 error while creating Online Meeting using microsoft graph api c# without login into AzureActiveDirectory

Issue Getting User Chats - Graph API

I am trying to get signed in user's chat messages in a B2C Tenant. I am getting 401 Unauthorized error. Tried the same with graph explorer which is also giving same error. I am using https://graph.microsoft.com/beta/me/chats endpoint. As per MSDN documentation, I have already given permissions to my Azure app. When I am trying this with a non B2C tenant, the API call succeeds.
Please help me with this issue. Error I am seeing is given below.
{
"error": {
"code": "Unauthorized",
"message": "Unauthorized",
"innerError": {
"date": "2021-06-24T15:30:29",
"request-id": "f2804d78-59d2-4917-ae2e-cb73b3eb0872",
"client-request-id": "52452dfc-cae9-d409-92b9-9e9586cab6c3"
}
}
}
With some research I found out that B2C tenants don't allow Teams at the first place. I have switched to a B2B tenant and it started working like a charm.

Graph API encounter 400 failed to get drive in china

Before a day, the operation works fine.
https://microsoftgraph.chinacloudapi.cn/v1.0/users/{user_id}/drives
Suddenly, it keeps encounter this error:
{
"error": {
"code": "BadRequest",
"message": "Unable to retrieve user's mysite URL.",
"innerError": {
"request-id": "d50647af-33c2-4503-a6c1-eb046173108c",
"date": "2018-04-03T08:33:58"
}
}
}
I have checked the subscription and APP permission in graph API, all permission is enabled
And I have tested another APP using the same graph API permission which works fine.
Do not know what going wrong here
Thanks you.

Microsoft Graph InTune Beta API's - Unable to add app to app policy

I am attempting to use Intune specific beta Graph APIs to assign apps to an iOS managed app protection policy. I am able to create the app policies using the endpoint documented below:
https://graph.microsoft.io/en-us/docs/api-reference/beta/api/intune_mam_iosmanagedappprotection_create
When created via API, the app "deployedCount" is 0 until specific apps are added in the admin console UI.
Now, I am attempting to retrieve apps added to any policy by API using the endpoint documented below.
https://graph.microsoft.io/en-us/docs/api-reference/beta/api/intune_mam_mobileappidentifierdeployment_list
I get a 400 bad request response that appears to say this endpoint either does not exist or is not responding correctly. This seems unlike if I mistyped an endpoint.
Response I receive:
{
"error": {
"code": "No method match route template",
"message": "No OData route exists that match template ~/entityset/key/navigation with http verb GET for request /MAMAdmin/MAMAdminFEService/managedAppPolicies('T_338de6df-386d-4f1b-a51c-a0d189c61722')/mobileAppIdentifierDeployments.",
"innerError": {
"request-id": "79514f29-4dca-48a5-a2de-5d14138577d7",
"date": "2017-02-08T17:46:52"
}
}
}
Response if I mistyped:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'asdfasdf'.",
"innerError": {
"request-id": "e86d84ab-f062-4780-af3c-9afae6e7bc82",
"date": "2017-02-08T18:53:29"
}
}
}
Hello this is Alemeshet Alemu from MSFT.
Sorry, the API documentation is a bit out sync. Could you try with $expand?
GET /managedAppPolicies/{managedAppPoliciesId}?$expand=mobileAppIdentifierDeployments
Alemeshet Alemu (MSFT)

Resources