Get deleted event data using graph api - microsoft-graph-api

I have subscribed a room calendar using graph api and subscribing all the events like Create , Update and Delete.
In my scenario when user invited above room abc#onmicrosoft.com and then cancel original meeting then cancel event get fired in room calendar. two things happen
Instead of getting delete notification , I get update notification. Now, assuming this behavior is due to event has moved to different folder which i am assuming is deleteditems in this case, so its being notified as an update. Can some one confirm if its correct behavior or a bug?
when above event happens the id in the notification response i am getting is same id before the event was cancelled, trying to search the event using above id using graph api for above room abc#onmicrosoft.com.
var Evt = await graphServiceClient.Users[resourceId].Events[itemid]
.Request()
.GetAsync();
but here i am getting ErrorItemNotFound error. i am assuming this is due to this event has now moved and its id has now been changed. so seems like id sent by notification is not useful here as did not find any api which can search for deleted events.
My main purpose is to somehow fetch the icaluid of above event, but as we are unable to search it using the id given by above notification.
i tried various methods suggested on other post like searching in delteditems folder, but this also does not provide the icaluid information information i am looking for .
var myevents = await graphServiceClient.Users[resourceId].MailFolders.DeletedItems.Messages
.Request()
.GetAsync();
events = myevents;
and tried to expand it as well to give the vent specific data
var myevents = await graphServiceClient.Users[resourceId].MailFolders.DeletedItems.Messages
.Request()
.Expand("eventMessage/event")
.GetAsync();
but this gives an error saying
System.AggregateException: One or more errors occurred. (Code: BadRequest
Message: Parsing OData Select and Expand failed: Could not find a property named 'eventMessage' on type 'microsoft.graph.message'
Does anyone know if its possible to get a the particular deleted events data, i searched through various post and it seems like this is still not supported operation.
Let me know if there is any reliable trick can be used to get the data.

Related

Twilio completed room - can it be rejoined/recreated?

I'm using the REST API to create rooms. In the docs, it says a room will end when empty for 5 minutes. I would like to know what this means when trying to reuse the same room. Can participants rejoin that room again?
My use case is that users make request to join a room via a server endpoint. A check by UniqueName is performed to see if this room exists. If it does not, it is then created using the UniqueName.
There will certainly be cases where a room is created but is empty for more than 5 minutes, and I would like to re-use the same UniqueName to join the room (empty, completed or otherwise). But it's not clear to me that this can be done once a room is completed.
E.g., if another user tries to join the completed room, will the logic from above still work, or will it break b/c the room is in completed status can cannot be joined or re-created? My goal is to always have access to a room with the same UniqueName.
Please advise, thanks.
Edit
I just had a thought to instead retrieve a list of rooms by UniqueName, which would show me a room that has already been created, regardless of its status. However, I would still need to be able to use the same room if its status is completed.
Can the status be updated from completed to in-progress?
Update
It would seem that the status cannot be updated from completed to in-progress. So, when a room is completed, how I can I continue to use the same UniqueName for another room if one already exists with that unique name?
Answering my own question here as I think I have a solution.
After tinkering with the Twilio quickstart app, I discovered that the UniqueName is unique in the context of rooms that are in-progress. I verified this by joining and leaving a room multiple times within a few seconds. A new room was created every time I left. I wasn't aware of this, but rooms created via client SDK will close instantly after all participants leave. As stated in the docs, rooms created via the REST API remain open for 5 minutes.
When I say "created", I mean that a new room with a new SID is created and can be viewed in the Twilio console, even if the UniqueName has not changed. So you can in fact have multiple rooms with the same UniqueName, but only the room with status in-progress is evaluated against when making REST API calls.
Thus, the answer would be to simply try to create a room with a unique name. Doing so when the room exists results in a 404 error as stated in the docs. Ie:
{ [Error: Room exists]
status: 400,
message: 'Room exists',
code: 53113,
moreInfo: 'https://www.twilio.com/docs/errors/53113',
detail: undefined }
However, if a room with that unique name was already completed, a new room with the same unique name can be created. The simplest approach would be to try/catch on creating a room and handle the error.
let room;
try {
room = await client.video.rooms.create({uniqueName: 'test'})
} catch (e) {
console.log(e);
}

Microsoft graph API: finding event by iCalUid

I would like to decline one instance of recurring meeting. I only have masterSerieId, iCalId, time of that instance.
Do you know how I could cancel that instance?
Do I have to query using masterId and time of the instance to find event id or there is a way I would just find eventId using iCalId?
You can use OData query options to filter on just the event that has that particular iCalUId.
For instance:
GET https://graph.microsoft.com/v1.0/me/events?$filter=iCalUId eq '<your iCalUId>'
Sadly the calendar view endpoint does not include events which are part of an event series if you match against a given iCalUId.
So if an event has a seriesMasterId which is not null, you wont find it by filtering for the iCalUId.

How can I implement this type of redirect after post method in MVC

I am currently creating an MVC application that is currently getting a value from a post from a webhook. I think that the problem is that the application is getting the value from the POST verb but then it is not displaying it because the Get verb is being used to display the View so both Verbs are counter acting each other.
The webhook will fire A Json payload to my application successfully because I have code in it that will send the Json payload in a variable via email to my email account.
Dim body = issue.issue.key
mail.Body = body
That is in a try catch block because in order for it to have a value it must have a value in it and the application will perform the GET first, so there is a null value in the body variable, then it does the POST to get the value but it will not display the value, refreshing will just perform the GET preventing it from being displayed. How can I perform both actions at the same time so I can display a value in a ViewBag for example.
ViewBag.response = status + key
This is the type of structure that I would like to implement to try and fix the error but I do not know how to complete all of the steps:
This is what I have got so far:
The POST is coming in from a webhook and I am reading it like this.
Dim reader As System.IO.StreamReader = New System.IO.StreamReader(HttpContext.Request.InputStream)
Dim rawSendGridJSON As String = reader.ReadToEnd()
Dim tempVar As Rootobject = JsonConvert.DeserializeObject(Of Rootobject)(rawSendGridJSON)
System.Diagnostics.Trace.TraceError(rawSendGridJSON)
I am then trying to store the post values in a table like this:
Public Function CallBack(tempTable as temporaryTable)
Dim tempVar As Rootobject = JsonConvert.DeserializeObject(Of Rootobject)(rawSendGridJSON)
tempVar = temporaryTable.tempVar
I then save the new items in the actual table in the database, then I try to display it in a view on another page. This is not working correctly and the problem lies with this line, as the post is not being correctly read in at the right time. (The value is processing correctly as I can use an email method to send the variables in an email back to the application but this application needs to be real-time efficient code).
Is there a better way to use this method and how can I invoke this process that I want to do properly so that I can display the correct information?
Update
To clarify, there are two posts that are happening, the first one is when the user enters in information and submits it. This is then stored in a database and send to JIRA via email. Once JIRA receives the information, it is sends a HTTP POST webhook JSON Payload back to my application with updated information. I then have deserialized the JSON Payload into a variable called issueKey.
The problem is that on the View page that the information is sent to will automatically display a null value first before the value is sent to it, I want the application to work so that it will actually display/store in a database the values from the Webhook JSON Payload but I cannot figure out how to display the values.
I have now set up a communication channel from SignalR to my MVC application, at the moment it is being received by the MVC and I have set up a SignalR chat Hub in my MVC application, but I don't know how to integrate them, how can this be done?
As I understand it, there are two flows at work here. The user posts data, which triggers an email to Jira. Then sometime later (usually quite fast, but not always) JIRA triggers a webhook in the web application with some updated information, and you want to display this updated information to the user somehow, or at least inform the user when the updated information comes back from JIRA.
I would implement a standard Post-Redirect-Get for the user initiated part (as per br4d's comment). I.e. a post to store the data in the database and send email to jira, which returns a redirect to a get which shows the data stored in the database.
Now for the other part I would use signalr to set up some sort of communications channel to the user. The webook could then send a signal (of sorts) through the communication channel to the users browser and either display the data, or trigger a refresh of the page (if you are updating the database with data from Jira).
It is unclear if you are doing straigt mvc, or some sort of SPA application, but it is not really important. The users browser has no way of knowing about the webhook (which is a part of the webapplication and unrelated to the users session), and you need some sort of communication between the webapplication and the browser, and for this signalr is very very good.

Eventbrite VenueID is missing

I am making a call to;
https://www.eventbrite.com/xml/organizer_list_events?id=MYID
and getting a collection of event returned. I am integrating this data into an internal event system.
However, periodically I will get a venue without an ID. This means I cant add the venue into the system as I have no way of checking for duplicates before it is imported.
Show the VenueID always be returned? If not, under what circumstances would it not be returned?
The venue Id will not be returned if there is no venue, e.g. if the event is a webinar / online only event or the venue is not yet chosen

Custom email notifications for "Digest" type of alert subscription

I am working on a custom email notification for a WSS 3.0 solution. I am using a custom class inheriting from IAlertNotifyHandler to generate the email. There is a great example here that shows how this is done for an Immediate alert. Here is some of the code related to the SPAlertHandlerParams, which is used to get information about the alert and the item that triggered the alert.
SPAlertHandlerParams ahp;
int id = ahp.eventData[0].itemId; //gets the itemId of the item triggering the notification.
SPListItem myItem = list.GetItembyId(id);
For immediate alerts, this works great as the item I want is always at the [0] position of the eventData object. For a digest event, I thought I could just loop through all of the items in the ahp.eventData. Two problems with this.
First, it gives me all of the events where it is sending notifications, not just the ones for me. Second the eventData[0].itemId no longer points to a valid id on the list. It is 6-7 digit number instead of a 3 digit number.
Does anyone know the correct way to get to the alert information for digest emails?
Please let me know if you have any additional questions about this.
Thanks for your help!
For my project, I created a custom timer job (using the post by Andrew Connell) that mimics the Alert functionality. It runs overnight and queries for any users subscribed to my list with daily alerts. It then packages all of the new tasks into a custom email message.
I left the custom alert in place to suppress any daily notifications from the system. I just return 'True' so that alerts are not sent for tasks assigned to only 1 person. I suppose looking back on this, I could have run the query code in the custom alert and not need a separate timer job.

Resources