Couldn't create a dynamic distribution group via Graph API - microsoft-graph-api

I'm trying to create a dynamic distribution group using Microsoft Graph API but it always results to an error:
POST https://graph.microsoft.com/v1.0/groups
{
"displayName": "Dynamic Group",
"groupTypes": ["DynamicMembership"],
"mailNickname": "dynamic1",
"mailEnabled": true,
"securityEnabled": false
}
Result:
{
"error": {
"code": "Request_BadRequest",
"message": "The service does not currently support writes of mail-enabled groups. Please ensure that the mail-enablement property is unset and the security-enablement property is set.",
"innerError": {
"request-id": "748bcafc-f655-463c-b8d3-4ffc55307232",
"date": "2016-09-13T13:23:36"
}
}
}
Interestingly, when I add "Unified" to groupTypes, it shows a different errors:
{
"displayName": "Dynamic Group",
"groupTypes": ["DynamicMembership","Unified"],
"mailNickname": "dynamic1",
"mailEnabled": true,
"securityEnabled": false
}
Result:
{
"error": {
"code": "Request_BadRequest",
"message": "A value is required for property 'MembershipRule'.",
"innerError": {
"request-id": "58c5d344-c69b-4c9b-8997-28df35c78cb8",
"date": "2016-09-13T13:24:43"
}
}
}
However I couldn't find any documentation about the 'MembershipRule' field.
If I just use the "Unified" group type, it succeeds. But what I need is "DynamicMembership"
{
"displayName": "Test 5",
"groupTypes": ["Unified"],
"mailNickname": "test5",
"mailEnabled": true,
"securityEnabled": false
}
Is it possible to create dynamic distribution groups using Microsoft Graph API? Here is the documentation:
http://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/group_post_groups

Currently, Microsoft Graph API cannot be used to create groups with dynamic membership. We are working on enabling the feature and it should be available soon. Till then, please use the Azure portal to create such groups.

Related

Getting 400 bad request from Microsoft Graph Api for SchemaExtensions

Limit of: 5 extension schema definitions can be written. !
Here is the response
{
"error": {
"code": "BadRequest",
"message": "Limit of: 5 extension schema definitions can be written.",
"innerError": {
"date": "2020-10-26T12:29:47",
"request-id": "requestID",
"client-request-id": "client-requestID"
}
}
}
And here is the request body
{
"id": "myMetaData",
"description": "My description",
"targetTypes": [
"Group"
],
"properties": [
{
"name": "shortName",
"type": "String"
},
{
"name": "supervisor",
"type": "String"
}
]
}
I have used delegated permision and used token generated by password since SchemaExtension needs delegated one and doesn't support application perm.
I got the answer , it was due to limit of the schemaExtensions that could be created other developer on the project already created 5 and since this was the limit set it showed this error

Unable to retrieve event details using Microsoft Graph API 1.0

Has anyone got Microsoft Graph API working for EventMessage? i.e reading email content of EventMessage using Graph API.
Looks like it has actionable card and graph API 1.0 is not able to read it.
Provided delegate access to user for a room resource.
On event creation for that room, mail is received by the delegated user in inbox. The mail type is eventMessage ("#odata.type": "#microsoft.graph.eventMessage").
On fetching the mail through GraphAPI v1.0, the event values are not visible in the response.
Also on setting the Expand property for the mail in graph API as per docs, results in below error.
{ "error": {
"code": "BadRequest",
"message": "Parsing Select and Expand failed.",
"innerError": {
"request-id": "310bbcce-bdd8-4cb6-890c-035243a5ab6d",
"date": "2020-01-21T09:18:10"
}
}
}
I'm unable to repro your issue. The Microsoft Graph API returns details for event messages. Can you provide repro steps, request/response capture, and the values that you'd expect to see?
I used v1.0/me/messagesto get all of the messages to find an eventMessage. I then perform the following to get details on the eventMessage:
GET https://graph.microsoft.com/v1.0/me/messages/{messagedId}
Response body:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('d09-94-498-a9777d4b')/messages/$entity",
"#odata.type": "#microsoft.graph.eventMessage",
"#odata.etag": "W/\"DAA2pU9s\"",
"id": "AAMkADEzOTExYjJkAAA=",
"createdDateTime": "2020-01-24T14:47:24Z",
"lastModifiedDateTime": "2020-01-24T21:08:07Z",
"changeKey": "DApU9s",
"categories": [],
"receivedDateTime": "2020-01-24T14:47:25Z",
"sentDateTime": "2020-01-24T14:47:11Z",
"hasAttachments": false,
"internetMessageId": "<AM5P3M#A38.EURPRD83.prod.outlook.com>",
"subject": "Accepted: Microsoft Graph DevX Roadmap",
"bodyPreview": "",
"importance": "normal",
"parentFolderId": "AAMk3AAA=",
"conversationId": "AAQkADEzOU4=",
"conversationIndex": "AdXReVPepTg==",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": true,
"isDraft": false,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"meetingMessageType": "meetingAccepted",
"body": {
"contentType": "text",
"content": ""
},
"sender": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"from": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Michael Mainer",
"address": "mm#contoso.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"flag": {
"flagStatus": "notFlagged"
}
}

How to create item with column that has strange SharePoint internal encoding?

I created a column with the name "col1" in the list through the web interface Office 365. When I tried to get whole info about this column using msgraph request to
GET /sites/{site-id}/lists/{list-id}/columns/{column-id}
I got such the response:
{
"#odata.context": ...,
"columnGroup": "Custom Columns",
"description": "",
"displayName": "col1",
"enforceUniqueValues": false,
"hidden": false,
"id": "a9fe9dc8-c5b8-467d-8504-23d95f1cc937",
"indexed": false,
"name": "_x0063_ol1",
"readOnly": false,
"required": false,
"number": {
"decimalPlaces": "automatic",
"displayAs": "number",
"maximum": 1.7976931348623157e+308,
"minimum": -1.7976931348623157e+308
}
}
So the problem is that I cannot create an item with that column (I tried both names "col1" and "_x0063_ol1"). The request was to
POST /sites/{site-id}/lists/{list-id}/items
with the body:
{
"fields": {
"Title": "Test2",
"_x0063_ol1": 42
}
}
I got response:
{
"error": {
"code": "invalidRequest",
"message": "Field '_x0063_ol1' is not recognied",
"innerError": {
"request-id": "dbb98ed3-0c2f-48dc-924e-dd888e70c867",
"date": "2018-05-02T07:41:36"
}
}
}
How can I properly create the item with this column using msgraph API?

Bad request when creating windowsMobileMSI in Intune using microsoft graph api

I'm trying to create a windowsMobileMSI app in intune.
I use the following JSON:
{
"#odata.type": "#microsoft.graph.windowsMobileMSI",
"displayName": "API uploaded Package",
"description": "Desc of Api uploaded pkg",
"publisher": "publisher 1",
"isFeatured": false,
"privacyInformationUrl": "",
"informationUrl": null,
"owner": "owner 1",
"developer": "dev 1",
"notes": "no notes",
//File info
"committedContentVersion": "1",
"fileName": "PackageProvider.msi",
"size": 409664,
"identityVersion": "1.0.8",
"commandLine": "",
"productCode": "{cc12adbd-8692-458d-b186-9d83b639ff1d}",
"productVersion": "1.0.8",
"ignoreVersionDetection": false
}
However when I post it to
POST https://graph.microsoft.com/beta/deviceAppManagement/mobileApps
I get the error message
{
"error": {
"code": "BadRequest",
"message": "An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: fd5ee560-f4da-4255-b893-aa133c60fe4b - Url: https://fef.amsub0102.manage.microsoft.com/StatelessAppMetadataFEService/deviceAppManagement/mobileApps?api-version=5017-10-18 - CustomApiErrorPhrase: ",
"innerError": {
"request-id": "fd5ee560-f4da-4255-b893-aa133c60fe4b",
"date": "2017-12-22T08:31:35"
}
}
}
I took the lines below the "//File info" comment from an existing windowsMobileMSI app.
I tried removing of these lines but it didn't help me.
Can anyone advise me what is wrong with my JSON?
I've got an advice to use only the "identityVersion" after the //File info.
So here's the JSON that works now:
{
"#odata.type": "#microsoft.graph.windowsMobileMSI",
"displayName": "API uploaded Package",
"description": "Desc of Api uploaded pkg",
"publisher": "publisher 1",
"isFeatured": false,
"privacyInformationUrl": "",
"informationUrl": null,
"owner": "owner 1",
"developer": "dev 1",
"notes": "no notes",
//File info
"identityVersion": "1.0.8",
}
Try removing "size": 409664 from the JSON.

$count=true support in OneDrive API?

It looks like the OData $count parameter is not (yet?) supported in the Microsoft Graph API v1.0 for OneDrive.
Request URL: https://graph.microsoft.com/v1.0/me/drive/root/children?$count=true
Response:
{
"error": {
"code": "",
"message": "The query specified in the URI is not valid. Query option 'Count' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.",
"innerError": {
"request-id": "e65aff74-1c6f-434b-8cd3-04e0c247fb71",
"date": "2016-10-19T09:48:39"
}
}
}
Is this understanding correct?
The $count parameter isn't supported with OneDrive. You can get a count of the children however by moving one level up:
/v1.0/me/drive/root/
This includes a folder property that contains the number of child items:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('id')/drive/root/$entity",
"createdDateTime": "2012-08-03T08:12:58Z",
"id": "{id}",
"lastModifiedDateTime": "2016-10-18T14:19:21Z",
"name": "root",
"webUrl": "{webUrl}",
"folder": {
"childCount": 28
},
"root": {},
"size": 0,
"specialFolder": {
"name": "documents"
}
}

Resources