-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation Error when adding Attribute to arguments later #66
Comments
What happens if you try I know it's technically the same as was was declared in args, but I'm curious if that it somehow makes a difference. Alternatively what if you did null in the args instead of "" |
Also, can you provide the exact error message? |
Unfortunately I won't have access to that machine and Exchange Server till monday. But I'll make sure to post the error message now and the one to "" and null as well then |
Also posted the problem on StackOveflow and got the following response. Maybe you can use that as well
|
Ok, So "" and null have the same effect. If the Subject is not previously set to something in the args and later defined this is the error message you'll receive
|
It looks like Subject cannot be blank: However your statement just now about
is a bit confusing. You stated in your original message:
So does this error happen if you leave it blank ("" or null)? If so then this should be answered by definition of Subject in the MS link above. Or does this error only happen if you set it then later change it? |
It just happens if i haven't previously set it. So I completely leave out Subject and define the "Items" like then `args.Items.CalendarItem.Subject = req.body.Subject' then ews.run it will not work. Even though the result of console.log(args) will look exaclty the same. |
That is interesting. I'd suggest taking a peek at the generated XML. The way I do that is to edit \MY_NODE_PROJECT\node_modules\node-ews\node_modules\soap\lib\client.js Try comparing the working XML to the broken XML and see if anything jumps out at you. |
OK. The only difference I see is the order of the tags. I'll post 2 xmls. The first one is the non-working one. The second one will work.
Here's the working one
Still a little bit weird that seems to be enough to fail validation. |
It is picky about the order of elements so that makes sense. However it doesn't make sense that even though you've defined Subject in your args (albeit as "") that it somehow changes the order when you later set it. I have done that in several of my scripts without issue. It's a bit off-the-wall, but can you test if maybe if setting it as ["Subject"] instead of .Subject makes a difference like so:
Alternatively something I've also done with success is to create a template object and then merge my args with it like this:
You can also simplify this by just merging the CalendarItem:
|
Just following up on this. Were you able to get it working? |
Yep. Ill elaborate a bit more when Im back from vacation. So much. I figured out what happens but you won't be able to change the behaviour |
Thanks for the update! |
@relief-melone, just a friendly reminder. |
I have a weird problem at the moment when creating an appointment. My last issues were solved pretty quick and it was more the problem of the guy behind the screen but this one leaves me completely cluess. First im setting my args like this
if after that I change for example the Subject by
everything works fine. However if Subject is not yet set in args the Validation of node-ews passes an error saying that CalendarItem has an invalid child "Subject". req.body.Subject is a normal String and yet the validation only works if I overwrite it and its already present in CalendarItem.
The text was updated successfully, but these errors were encountered: