How to create item with column that has strange SharePoint internal encoding? - microsoft-graph-api

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?

Related

Filtering on expanded list

Awhile ago I asked a related question. I've since then discovered that this query gets me very close to what I'm looking for:
https://graph.microsoft.com/v1.0/users?$expand=appRoleAssignments
with a return of
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(appRoleAssignments())",
"value": [{
"displayName": "Homer Simpson",
"jobTitle": "Nuclear Engineer",
"userPrincipalName": "homer#powerplant.com",
"id": "fdd865df-2715-4637-adb4-ee81e8f7fbdc",
"appRoleAssignments#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('fdd865df-2715-4637-adb4-ee81e8f7fbdc')/appRoleAssignments",
"appRoleAssignments": [{
"id": "ac-zitxw_Uiu2Lzm4rqdErfVvk5zpsVOnQlgbPkTgQo",
"appRoleId": "cde6f719-acc1-419b-a085-dff24137265b",
"principalDisplayName": "Homer Simpson",
"principalId": "fdd865df-2715-4637-adb4-ee81e8f7fbdc",
"principalType": "User",
"resourceDisplayName": "my-nuclear-explosion",
"resourceId": "d52ee6ae-70d7-4932-a89d-60d418828b41"
}]
}]
}
What I'm struggling with is trying to filter off the appRoleAssignments.resourceId, and am looking for help on how to achieve this.
Here are some of the following queries I've tried, and their errors:
https://graph.microsoft.com/v1.0/users?$expand=appRoleAssignments($filter=resourceId eq d52ee6ae-70d7-4932-a89d-60d418828b41)
{
"error": {
"code": "Request_BadRequest",
"message": "Invalid $select properties."
}
}
https://graph.microsoft.com/v1.0/users?&$expand=appRoleAssignments&$filter=appRoleAssignments/resourceId eq d52ee6ae-70d7-4932-a89d-60d418828b41
{
"error": {
"code": "BadRequest",
"message": "Invalid filter clause"
}
}
Any help would be appreciated!
If you want to filter by a guid then wrap the guid in single quotes.
https://graph.microsoft.com/v1.0/users?$expand=appRoleAssignments&$filter=appRoleAssignments/resourceId eq 'd52ee6ae-70d7-4932-a89d-60d418828b41'

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"
}
}

Outlook event RSVP graph api issue

Created an Event with Microsoft Graph:
{
"subject": "TEST",
"body": {
"contentType": "HTML",
"content": "test event respond"
},
"start": {
"dateTime": "2019-05-22T00:00:00",
"timeZone": "Asia/Kolkata"
},
"end": {
"dateTime": "2019-05-22T00:00:00",
"timeZone": "Asia/Kolkata"
},
"location": { "displayName": "Leena AI" },
"attendees": [
{
"emailAddress": {
"address": "sachin#live.com",
"name": "Sachin Goel"
},
"type": "optional"
}
],
"isReminderOn": false,
"reminderMinutesBeforeStart": 15
}
If I try to accept the event from sachin#live.com user it throws an error:
{
"error": {
"code": "ErrorItemNotFound",
"message": "The specified object was not found in the store.",
"innerError": {
"request-id": "485528b0-dbbe-42f5-80c0-5fc91477fc31",
"date": "2019-04-30T07:11:58"
}
}
}
sample request:
https://graph.microsoft.com/v1.0/me/events/{eventId}/accept
{
"comment" : "respond from api"
}
It results in NotFoundError but this works from UI. I have tried different solution (updating permission, primary calendar) but nothing works
Are there any constraints with this flow at the API level?
The Event ID for the Event you created in your mailbox is not going to be the same as the Event ID in the sachin#live.com mailbox.
You need to find the message with the sachin#live.com mailbox and then accept that id.

Create a JIRA ticket via service desk api

I am trying to create a ticket in JIRA by following https://docs.atlassian.com/jira-servicedesk/REST/3.6.2/#servicedeskapi/request-createCustomerRequest
I send a post request to https:/x.atlassian.net//rest/servicedeskapi/servicedesk/request
With following json param
{
"serviceDeskId": “1”,
"requestTypeId": “1”,
"requestFieldValues": {
"summary": "Request raised via service REST API",
"description": "test."
}
}
But it replied with 404 error
{
"errorMessage": "Invalid project key 'request'",
"i18nErrorMessage": {
"i18nKey": "sd.error.project.by.key.not.found",
"parameters": [
"request"
]
}
}
Update - the service desk id and request type id got from a response of rest/servicedeskapi/request/{issueid}. Therefore values used for service desk id request type id can not be wrong
I tried servicedesk/1/requesttype/1/field and I received
{
"requestTypeFields": [
{
"fieldId": "summary",
"name": "Subject",
"description": "",
"required": true,
"defaultValues": [],
"validValues": [],
"jiraSchema": {
"type": "string",
"system": "summary"
}
},
{
"fieldId": "description",
"name": "Body",
"description": "",
"required": false,
"defaultValues": [],
"validValues": [],
"jiraSchema": {
"type": "string",
"system": "description"
}
}
],
"canRaiseOnBehalfOf": true,
"canAddRequestParticipants": true
}
I am not able to understand what am I missing. Can someone please advice
Issue was with the url. There is an unnecessary 'servicedesk' in the url.
After removing that it worked.
https:/x.atlassian.net//rest/servicedeskapi/request

$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