SOLVED

Error saving event when participant has an apostrophe in login name

Brass 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."

 

PaulL_0-1666256010718.png

 

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.

 

PaulL_1-1669421603685.pngPaulL_2-1669421617697.png

 

 

best response confirmed by PaulL (Brass Contributor)
Solution

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.

 

PaulL_0-1669422860413.png

 

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(userName.search("'") >= 0) {
  userName = userName.replace("'", "''");
}

 

1 best response

Accepted Solutions
best response confirmed by PaulL (Brass Contributor)
Solution

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.

 

PaulL_0-1669422860413.png

 

View solution in original post