Error saving event when participant has an apostrophe in login name

Occasional Contributor

In modern SharePoint Events web part, if you attempt to create an event, and add a participant user that has an apostrophe in their username, an error occurs:-


"Can't save this event. Refresh this page and try again or contact the site owner. The query string logonName is missing or invalid."




5 Replies

@PaulL Seems like a bug in Microsoft functionality (APIs used behind the scene to create events).


Raise a support ticket with Microsoft directly and report this issue: Get M365 support - online support 


Also, curious to know what is the error message in browser console? What is the API URL generated and shown in console? 

Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

@ganeshsanap the error is generated by a batch call to web.ensureuser. The apostrophe is clearly not being escaped correctly in the request url. I've submitted a ticket to MS support.





best response confirmed by PaulL (Occasional Contributor)

As a test, I doubled the single apostrophe and the api call does work in that case, so should be simple enough to fix I would think.




Correct!!! This call fails when the userName has " ' ". Below you can automatically add extra single quote when before the existing one when using ensureUser endpoint


if("'") >= 0) {
  userName = userName.replace("'", "''");