As written in Microsoft Graph documentation, Event update endpoint allows responseRequested as one of the input property. It says:
Set to true if the sender would like a response when the event is
accepted or declined.
I tried setting it to false and I'm expecting it to have similar behavior with "Request responses" button in the UI. Unfortunately, it does not work as I'm expecting it to behave.
For example, in the web UI, if you turn "Request responses" off, no notification will be sent to the attendees and a message that shows no attendance response is required.
UI Screenshot
UI Screenshot - Expected behavior
For the code itself:
type UpdateEventRequest struct {
ResponseRequested bool `json:"responseRequested,omitempty"`
End *DateTimeTimeZone `json:"end,omitempty"`
}
type DateTimeTimeZone struct {
DateTime string `json:"dateTime,omitempty"`
TimeZone string `json:"timeZone,omitempty"`
}
func NewDateTimeTimeZone(t time.Time) *DateTimeTimeZone {
return &DateTimeTimeZone{
DateTime: t.Format("2006-01-02T15:04:05.999999"),
TimeZone: t.Location().String(),
}
}
When I tried to update an event to the following:
&UpdateEventRequest{
ResponseRequested: false,
End: NewDateTimeTimeZone(newEventEndTime),
}
Event end time is updated properly to newEventEndTime. However, ResponseRequested doesn't seem to update anything.
Am I missing something here? My initial goal is to change event end time via API without requiring attendance to submit "Yes/No" response. Thanks.
Related
I have been working to create an API which programatically creates/updates work item in Azure Devops. I have been able to create a work item and populate almost all fields. I have problem with setting the state.
When I am creating a POST request to Azure Devops rest api with any state name like "Active", "Closed", "Rejected", it throws a 400 Bad Request error.
I don't know if I am missing anything or if there something wrong with the way I am trying to set the value.
{
"op" : "add",
"path": "/fields/System.State",
"value"="Active",
}
I have found the solution to this problem and hence I am answering it here.
I was getting a 400 Bad Request error whenever I tried Creating an Item and Setting the state in the same call. I debugged the code and caught the exception. I found out that, there are some validation rules for some of the fields. State is one of them.
The rule for System.State field is, whenever a Work Item is created it takes its configured default value. ( In my case it was "Proposed", in your case it could be "New"). If you try altering the value at the time of work item creation, it throws a 400 Bad Request.
What should I do if I have to Create a Work Item with a specific State?
As of now, the solution that I have found out is to make two calls. One for Work Item Creation and another for Changing the state of the work item to desired state.
CreateWorkItem()
{
var result = await _client.Post(url, jsonData);
var result2 = await _client.Put(result.id, jsonData); // or maybe just the state
return Ok(result2);
}
Check the example here: Update a field
You have to use "value":"Active" in the request body.
[
{
"op" : "add",
"path": "/fields/System.State",
"value": "Active"
}
]
I am trying to retrieve Calendar View for a user using end point GET : https://graph.microsoft.com/v1.0/users/{UserEmail}/calendarView?startDateTime=2020-09-25T19:00:00-08:00&endDateTime=2020-10-02T19:00:00-08:00 and it returns
`{
"error": {
"code": "ErrorItemNotFound",
"message": "The specified object was not found in the store.",
"innerError": {
"date": "2020-10-23T15:11:51",
"request-id": "20409ad4-2f27-48bd-8fe8-690580ccd4e9"
}
}
}`
This is happening only for some users on our client environment.
Initially we thought, its an issue related to Permissions OR Access Token but both looks fine like user has all the permissions to read/write calendar and Access Token also looks valid too as some other end points which gives valid result with same access token.
So I tried Investigating it further more and found, if user has an exception type of Event on his outlook calendar then only /CalendarView end point returns 404.
For Example : This particular User has Exception type of Event on his calendar on Date 10/01/2020. So if I query Graph with same end point with different date range like GET : https://graph.microsoft.com/v1.0/users/{email}/calendarView?startDateTime=2020-09-25T19:00:00-08:00&endDateTime=2020-09-29T19:00:00-08:00 it works fine and it gives all the events between date ranges but if I change the endDateTime = 2020-10-02T19:00:00-08:00 it gives 404 response.
To validate this I tried to switch different end point
GET : https://graph.microsoft.com/v1.0/users/{email}/calendar/events?$filter=start/datetime ge '2020-10-01' and end/dateTime lt '2020-10-02'
Which works fine like it gives me the series Master Event
So I thought to use instances end point GET : https://graph.microsoft.com/v1.0/users/{UserEmail}/events/{EventId}/instances?startDateTime=2020-09-29T19:00:00-08:00&endDateTime=2020-10-26T19:00:00-08:00 to get all the instances of the Series Master Event but surprisingly it fails to return Exception type of event from this end point too. According to their documentation it supposed to return Occurrences and Exception of Series Master but for this user it only returns all Occurrence type of Event and failed to return Exception type of event which is on 10/01.
After that I tried one more end point POST : https://graph.microsoft.com/v1.0/me/calendar/getSchedule and found that specific event scheduled on his calendar.
but it only gives some information about the event.
Does any one knows how to solve this?
I'm looking to write events to a users calendar that correspond objects in my system. I also want the ability to update and/or delete those that change between runs of the process that updates the user's calendar.
To this end I'm using Open Extensions to write additional data onto the Calendar Events that I'm creating. This is working nicely and I can see the Extension data being written.
I can use a $filter to query for events that I have written to the user's calendar:
/v1.0/me/events?$filter=Extensions/any(f: f/id eq '{id}')
This works fine and I'm seeing the results I expect. It's worth noting that the id in this query works just fine with either the fully qualified form of Microsoft.OutlookServices.OpenTypeExtension.{extensionName} or just using the short form of {extensionName}
However I cannot get the events to return with the $expanded Extension. I've tried the examples from the docs but using this query it fails:
/me/events?$filter=Extensions/any(f: f/id eq '{id}')&$expand=Extensions($filter=id eq '{id}')
Like this:
{
"error": {
"code": "BadRequest",
"message": "Parsing Select and Expand failed.",
"innerError": {
"date": "2020-06-19T17:14:59",
"request-id": "d1125156-05a6-499a-b9a4-6c66e5ce377d"
}
}
}
I need the expanded Extension data to correlate the Calendar event back to the objects in my system to allow for updates or deletes as needed.
Does anyone know what might be happening or how to resolve this?
I got an answer through another question: Receiving 400s and 500s when attempting to get singleValueExtendedProperties
The issue is that the = symbol inside the $expand expression needs to be uriEncoded. The correct query to use is: /me/events?$filter=Extensions/any(f: f/id eq '{id}')&$expand=Extensions($filter%3Did eq '{id}')
I am trying to update Jira issue fields through REST Api, I am able to update summary, description, priority, reporter fields but the status.
Here is the code I am trying to run:
string jSonContent = (#"
{
""fields"": {
""summary"": ""data"",
""description"": ""modified."",
""priority"": {""name"": ""val""},
""reporter"": {""name"": ""abcdef#gmail.com""},
""status"": {""name"": ""WORK IN PROGRESS""}
}
}").Replace("data", summ).Replace("modified.", desc).Replace("val", pri);
request.AddParameter("application/json", jSonContent, ParameterType.RequestBody);
var response = Execute(request);
You cannot change the status of an issue the way like that.
To determine what type of fields could be changed with a simple PUT request do a GET for metadata:
https://{your-jira-url}/rest/api/2/issue/{issueIdOrKey}/editmeta
This query in turn will provide you all the fields that you can modify. You won't find status field in the returned JSON object.
Back to your problem: How could be the status of an issue changed? In Jira you have a workflow that holds the possible transition between the states. In order to change the state you need to do a transition. (Exactly the same way as you would do it on UI.)
So first do a GET request like that:
https://{your-jira-url}/rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields
This request will return all possible transitions of your issue's current state. Check which transition you want to perform and note it's ID (in my case the wished ID is 11). With this transition ID you can do a POST request with the JSON payload:
https://{your-jira-url}/rest/api/2/issue/{issueIdOrKey}/transitions
{
"transition": {
"id": "11"
}
}
One additional thing to note: If your transition isn't a simple one then you have to provide more data. I mean a simple transition here where you simply would click on a button on the UI and you wouldn't get an extra screen for the transition. (E.g. you can setup a transition like: you only could resolve an issue if you add a comment to it.) Fortunately, the previously returned transition list contains all the fields that could or that must be provided together with the transition ID.
You can find more information in official Jira documentation.
I have the following scenario:
An datatable with some editable columns which validate for input on the client with the webix rules. There are columns though, that cannot be validated on the client, but on the server only (ie for unique id/code).
An approach would be to create a rule and validate with webix.ajax in synchronous mode that I would prefer to avoid this at all means.
I thought I could validate on 'save'. The server can return a status response with error or success. I can catch this with onAfterUpdate event of the datatable (correct me if there is a better way, but it works this way).
At this point, I would like to display a validation error on the datatable if the server script returns an error status and mark the row (and possibly the corresponding column/cell) with error.
I thought I could use the callEvent method on the datatable and fire a onValidationError event but I didn't manage to make that work.
save: {
url: "save.php",
autoupdate: true,
on:{
onAfterUpdate:function(response, id, details) {
if (response.status == 'error')
myDataTable.callEvent('onValidationError');
}
}
}
The documentation states that I can pass some parameters to the event from callEvent but I could not find any specification on the docs. The code above does not work (the event is not fired).
So the question is: How can I fire a onValidationError event for the datatable using callEvent?
or what would be another approach to use webix to show the error on the datatable with validation on the server side?
Thank you.
Instead of calleing onValidationError event you can use
//mark cell, call after error response
myDataTable.addCellCss(id, columnId, "webix_invalid");
//remove mark, call after success response
myDataTable.removeRowCss(id, "webix_invalid");
which will mark the cell as non-valid.
On a side note, if you want to trigger some event with parameters, you can use code like next. Just beware that triggering an event is not a good way to change the component's state ( it can be used to trigger your own event handler though )
myDataTable.callEvent("event name", [param1, param2, param3])
just