Need to insert events with existing attendees default ACCEPTED - google-calendar-api

Our CMS handles events for DJS, mostly weddings. The client and DJ have already created the date and obviously the client has accepted. When inserting a new event, setting responseStatus to accepted, the attendee (client) still receives a request to accept or decline. This is causing a lot of confusion.
We simply need to generate and insert an event with attendees, already confirmed, with no action required on the attendee.
I've gone through the API and other help tutorials and created an object that handles the calendar. When trying to set various items such as responseStatus:"Accepted" -- each and every time all attendees require action. I just want the event to appear, no action required on any person.

Related

When is the firebase_campaign event triggered?

https://support.google.com/firebase/answer/7061705?hl=en states in passing that firebase_campaign is auto-generated. Unfortunately ‘Automatically collected events’ doesn’t document that particular event. When is it triggered?
firebase_campaign event is automatically triggered by user interaction and is not intended to be shown on the Firebase console. The data corresponding to event in form of the parameters is passed to Ads framework for further analysis and generating quality content.
The only way to obtain the data related to that event is via the Big Query export.

How do I create an Out of office type Calendar Event via the REST API?

Google Calendar has a new event type called "Out of office" that automatically will decline any events it is placed over and others that come in during the scheduled time of the event.
I inspected one of these event objects via the API and briefly checked the Google Calendar API documentation to see if there was a way to create these programmatically. I work on a system that schedules events on people's calendars when they are going to be out of the office as all day events to provide visibility to the rest of the staff. I would like to change these to be true Out of office event types if its possible via the API.
The short answer: It does not work currently (as of 08/2022)
The Google Calendar API currently exposes the eventType property as read-only. It will be discarded when sent in an insert payload.
eventType [string]: Specific type of the event. Read-only.
Possible values are:
"default" - A regular event or not further specified.
"outOfOffice" - An out-of-office event.
As mentioned by #ercliou in the comments, the ticket can be tracked here: issuetracker.google.com/issues/112063903
The only thing that seemingly marks an event as out of office is a private extended property on the event resource:
"extendedProperties": {
"private": {
"everyoneDeclinedDismissed": "-1"
}
}
Looking at https://developers.google.com/calendar/v3/reference/events/insert the attribute extendedProperties.private is writeable so you should be able to set it there.

Need Doctrine 2 lifecycle events clarification for encrypting data

So I'm confused about Doctrine 2's lifecycle events. I have a subscriber event class that implements prePersit, preUpdate, postUpdate, and postLoad. Basically what I'm trying to do is to encrypt an entity's particular value on "prePersist" and "preUpdate" (when updating a value), and decrypt the value on "postLoad".
The decryption is working perfectly. However, I'm currently having two problems with these lifecycle events:
when "preUpdate" is triggered, it encrypts the value correctly (looking at my debugger) but once it gets committed to the database, I can see the that value is in clear text. What's the deal here?
I have also implemented the "postUpdate" event, which I was thinking that it would be triggered after the update is committed to the database, which would give me chance to decrypt the value for viewing on the UI, but following the debugger this is not case. The preUpdate is triggered first when doing an update, then followed by postUpdate, and finally this changes are committed to the database. Which event life cycle should I be using for this case?
The signature on preUpdate must be on type PreUpdateEventArgs.
This link has more info on to get it working.

Using a class in PostBack

I am totally new to classes and OOP, so please bear with me.
I am creating a large scale web app which I'm trying to keep tidy by creating my own classes.
For instance I have a Public Class Product which has several properties. One way I am using it is on page load a product ID is assigned to the ID property which in turn gets the details for that product and assigns the various data to the other properties. So within my code I can used for example product.price or product.description and get the appropriate values. This has worked fine, but I found that because the class was initiated on page load it was getting the data from the DB each time that the page refreshed. I stopped this by using an If Not IsPostback to initiate the class. This meant that the data was pulled in only on the initial page load. So far so good.
I then needed to compare a value in a textbox with a property of the product. I have a textchanged event with
If textbox1.Text <> product.description Then....
but here I get a wavy line under product.description and VS2010 is saying that the object is not defined. Its Dim'd in the page.load so I moved the Dim statement outside the page class so that it will be accessible to all events on the page.
The dim statement is Dim product as New product
In my not ispostback chunk of code I have for example product.ID = 1 which will get all the product properties for product 1
The wavy line has gone but when I run the page all works fine on page load. Data is displayed so my product class is working fine. As soon as I make a change in textbox1 and the event triggers product.description is nothing. It got reinitalised.
How do I stop this from happening...
Your "Product" is not persisted between postbacks.
Only control objects in aspx page are persisted/restored automatically.
To remedy this there are multiple approaches.
If Product is loaded via setting "Product.id=1" then what I woudl do is have a hiddenfield that receives the value of the product.id during prerender event (to save it in the page) and in an init event I would restore the "Product.id=hiddenfield.value" but only when it is a postback to reload your object.
EDIT
Thanks for picking my answer. I'll elaborate a little on the various ways to deal with this and why I suggested my answer.
Store Key in HiddenField Reload from DB:
PROS: Product is always Fresh/Correct/Current values. Corresponding to the database. Databases are very efficient to return a record based on a primary key. Very little data is sent to and posted back from the client browser. Low complexity. Each page opened by the client is safely isolated.
CONS: Multiple database transactions. If the DB is already strained or extremely massive you may need to consider even the smallest efficiency gain, but this is not common or likely on a primary key based record
Session State (store entire object):
PROS: Lowest time to "load" object since it's available in memory already once loaded. Less DB Transactions. No data piggy backed to the client and back again.
CONS: Object can become "out-of-date" if altered in the DB. Users who open multiple pages of your application can end up getting the wrong object if both require a different "Product", so instead to be totally safe you need a more complex structure in place to store more then one product or store them based on some kind of key (such as the product ID). Server Memory is used, if serving thousands of users or your product data is large it can become an issue, especially if you do this in many pages with many objects.
Serialization (store the entire object in the page in a field, similar to event state):
PROS: Once loaded, the Database is accessed only once for a specific product, then the product is held, in it's entirety inside the page, it is recreated by the server from the data in the field or via viewstate. Each page opened by the client is safely isolated. Is fairly easy to implement storing in ViewState of the Page.
CONS: Object can become "out-of-date" if altered in the DB. ALLOT more data is added to your page responce and the users next page request. Is more complex to implement because the object needs to be designed to be serialized correctly. Complex objects require allot of manual code to be serialized successfully.
again, there are many other ways to deal with this, such as storing items in a synclocked dictionary style object global to the application, but is considerablby more and more complex as you go.
This is likely the standard ASP.NET page life cycle problem.
After you initialize the page, it gets sent to the user's browser. When the user clicks on something, the browser sends a postback request back to your application. The view state allows the textbox1 object to remember what was in its Text property. However, your Page_Load ran from scratch, and, yes, everything including your product object got recreated from scratch.
If you want your product object to "remember" what it knew before the postback, you'll have to remind it. One way would be to store the initialized value in Session state, and then refresh your product object during the postback section of the Page_Load method.
Every time you do a postback, you're working with a new instance of your page class. The prior copy of your class was thrown away and probably disposed before your browser even rendered the page to the screen.
If you want to persist a value across http requests (of which postbacks are just one type), then you need to put it somewhere like the Session.

Tracking down error on form or in session

Apologies if this is classic ASP 101, but its been so long since I did any ASP Im struggling to understand / track this error down. What makes it worse is Ive inherited this application and I cant ask the original author..
I have a shopping cart that includes an input checkbox and numerous other fields. When the form is processed and submitted it is run through some javascript and then if all is ok, redirected to another page. (Nothing unusual there). Firebug shows that at this point the value of the check box is different depending on its checked state.
When the form is submitted it goes to another page that iterates over the session.Contents() collection, and builds up a string that is sent to a 3rd party. Using fiddler, it appears that whilst the name of the checkBox is in this string, the value is always 'on'
From reading Google, I see that the session.Contents collection is all parameters that have been placed in the session / application. but a grep across all the files in the project directory doesnt turn up anywhere that the checkbox is added to the session.
So, is the cb there simply because it is on the form or used in javascript, or are there other ways of adding the variable into the session. (Grep on the name doesnt turn up any other instances).
And secondly, if the variable is in the session, no matter how it got there, why is it always set to "on". Im assuming that somehow it has been added to the session and set to On before the form is processed. But the checkbox defaults to unchecked, so Im confused!
Can anyone help explain this, or even suggest how I can track it down / fix it. (The obvious answer is to try to force it into the session with the correct value, but I'd like to know why it is misbehaving rather than just ignore it in case I meet something like this again!
Thanks
I am going to assume that you have already determined that the JavaScript is not modifying checkbox state priort to allowing the submission.
When your form is submitted, the fields that are submitted are in the Request.Form collection. When a checkbox is not checked, it is not part of the Request.Form collection. Therefore, there will be as many checkbox fields in your Request.Form collection as you had checked when submitting, and they will all have the value of their respective "value" property.
If you then add these to the Session.Contents collection, they persist until the session ends. If you never explicitly clear the Session.Contents collection, but submit the form more than once with different values, then the Session.Contents collection will continue to accrue more and more (checkbox_name, checkbox_value) pairs until such time as it contains a (checkbox_name, checkbox_value) pair for every checkbox on your form.
You may wish to write a function that clears each one of your form fields from the session, and call this either after processing a form, or before processing a form (whichever makes sense for your application). Alternatively, just use the Request.Form collection.

Resources