Im using EWS to update exchange appointments but sometimes I can't update them after they are created. I'm receiving:
"At least one recipient isn't valid., A message can't be sent because it contains no recipients."
The code is essentially:
Appointment appointment = getAppointment();
... set some properties
appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);
Isn't that supposed to work? Beforehand I didn't use the SendInvitationsOrCancellationsMode.SendToNone enum, but even with that I get the same exception.
It's never a problem to create the appointment, it's always the updates that we are having problems with.
For the sake of the log, I send a solution here. I managed to solve it with a workaround. It accepts it if I add a new item to the OptionalAttendees collection, when it is empty. Since I add the SendInvitationsOrCancellationsMode.SendToNone flag, it will send nothing, but finally accepts it without an exception.
if (EWSItem.OptionalAttendees.Count == 0)
EWSItem.OptionalAttendees.Add("me#me.com");
EWSItem.Update(ConflictResolutionMode.AlwaysOverwrite,
SendInvitationsOrCancellationsMode.SendToNone);
Related
I have wavefront alerts set up with the following alert condition:
ts(mytimeseries)<20000
Recently the datasource stopped sending data to wavefront but I did not receive an alert. I cannot figure out why this did not alert. Do I need to set up a separate alert for when data is not sent. Thanks
Yes in scenarios where there is no data sent you explicitly need to define the condition for that. Well the best approach is to create a new availability alert but still if you want to manipulate the same condition you can do something like below
default( 20001 ,ts(mytimeseries))<20000
In case there is no data found it will exceed your limit and will raise the alert
Last year I made a laravel site with an events table where I needed three fields to be unique for any event (place, date and time). I wasn't able to set up a validation request to do this so I added an unique index for these three fields directly through phpmyadmin and catching the exception that could happen if a duplicated event was inserted.
So basically my store() method has a try/catch like this:
try {
$event = new Event;
$event->place = $request->input('place');
$event->date = $request->input('date');
$event->time = $request->input('time');
$event->save();
return view(...);
} catch (\Illuminate\Database\QueryException $e) {
// Exception if place-date-time is duplicated
if($e->getCode() === '23000') {
return view('event.create')
->withErrors("Selected date and time is not available");
}
}
Well, now I had to change the app so events could be soft deleted and I simply added the 'deleted_at' field to the unique index, thinking it would be so easy... This approach doesn't work anymore so I've been reading here and there about this problem and the only thing I get is I should do it through a validation request with unique, but honestly I just don't get the syntax for this validation rule with three fields that can't be equal while a fourth one, deleted_at, being null.
My app checks for the available places, dates and times and doesn't let the user choose any not available event but no matter how many times I've told them there's always someone who uses the browser back button and saves the event again :(
Any help will be much appreciated. Thank you!
This is not a good approach to solve the problem.
You can do follow things to solve this problem
Before insert into database get a specific row if exist from database
and store into a variable.
Then check the data is already stored into the database or not.
If data is already there create custom validation message using Message Bag Like below.
$ifExist = $event
->wherePlace(request->input('place'))
->whereDate(request->input('date'))
->whereTime(request->input('time'))
->exist();
if ($ifExist) return 'already exist';
It might help you.
#narayanshama91 have pointed the right way.
You said you would like to use the unique rule to validate the input but the problem is that last week there was a post in Laravel Blog warning users of a possible SQL Injection via the unique rule if the input is provided by the user.
I would highly advise you to NOT USE this rule in this case since you depend on users input.
The correct approach in your case would be #narayanshama91 answer.
$ifExist = $event
->wherePlace(request->input('place'))
->whereDate(request->input('date'))
->whereTime(request->input('time'))
->exist();
if ($ifExist) {
return 'already exist';
}
here is the problem I'm stuck with:
I'm using Rails 4 & MySQL
I've Message which have one sender and one recipient.
I want to be able to archive messages but if sender archive a message, the recipient still can access to the message until he archive it too.
I've serialize a field :
serialize :archived_by, Array
which contains which user archived the message
but I can't figure out how to query with it.
Message.where("archived_by like ?", [1].to_yaml)
works well, returning messages archived by User '1'
Message.where.not("archived_by like ?", [1].to_yaml)
won't work, returning nothing
I would like to find something else than using a classic many to many ...
Thanks!
UPDATE
I finally decided to add 2 fields, one for the sender & one for the recipient to know which archived the message. If someone has the proper way to do this, tell us :)
If you are using postgresql you could query the informations.
As in answer Searching serialized data, using active record described, the downsize of serializer at least under mysql is, that you byepass native db abstraction.
I am working with a script to pull the response ID from a form submission so that when users edit their response, I can match the edit to the initial response. My script creates a .pdf of the contents of each form submitted, but when users edit responses, it creates a new form containing only the edited data, without linking it to the initial response.
The edit response contains a timestamp and the edited information, and the timestamp is used with Response.getId(timestamp), iirc, and returns the ID of the form submission. However, I am sometimes getting a very strange return, and I don't know where it comes from. The response is much shorter than a typical response ID (10-12 alphanumeric instead of 30+). I will try to comeback and edit this question with the code, but I'm on a different log in at the moment, so I'll have to swap over and copy code and come back. Running unit tests hasn't really helped, as I get the expected result most of the time. It's just an occasional hiccup, but I have to find where the incorrect information is coming from.
function getResponseId(timestamp){
var form = FormApp.openById('<formID>');
if(typeof(timestamp) != 'number'){
timestamp = new Date(timestamp);
}
var responses = form.getResponses(timestamp);
var entryId = responses[0].getId();
return entryId;
}
That's is. I suppose the if(typeof... may be throwing things off if it's passing in a Date string instead of the actual timestamp of entry, but I don't think so. I'll double check it and debug it in the meantime, and if I answer my own question, I'll come back and fix it.
Hmm. Sounds like the same behavior. What I decided to do instead was to match the timestamps that are recorded, but you have to grab the stamps in the 3rd line of code, as the old stamp is overwritten quickly. I just subtracted oldTime from newTime, left a 5 sec window to match them, and that worked. I just haven't had a chance to post it yet, as I just got it working for new submissions, edits, and failed writes about an hour ago.
Is there any scenario in which the Id field on a message could change?
We received a message at today (Thu, 19 Feb 2015 10:29:48 GMT +00:00) with an ID ending in 'MT80AAA='. However when trying to retrieve message details at a later time I get a 404 error with the message:
{ "error" : { "code": "ErrorItemNotFound", "message" : "The specified object was not found in the store." } }
When I do another request to get all messages from that inbox the same message appears however it has another ID ending in 'TwDlAAA='.
Both the message ID and the Attachment ID have been changed at some point from the first time receiving the message and now.
Is this a common occurrence? What could cause this? Or is it a bug?
It's not a bug, it's definitely a common occurrence with Exchange. Entry ID's aren't static, and can change in a number of scenarios. Common ones are moving the item (which is essentially a copy and delete operation, copy gets a new ID since it's a new item), or mailbox move (which may be applicable to your case).
Typically I would advise a strategy of optimistically storing the ID and using it first, since it will usually work. Then I'd recommend storing the record key and search key as a backup, so you could try searching for the item in the event the Id no longer works. However, the REST API doesn't expose these fields! So you'd have to make do with searching for the item based on whatever fields are important to you, which isn't ideal. I'll provide this feedback to our developers.