Forum Discussion

PaulL's avatar
PaulL
Brass Contributor
Oct 20, 2022
Solved

Error saving event when participant has an apostrophe in login name

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

 

 

  • 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.

     

     

  • ikas001's avatar
    ikas001
    Copper Contributor

    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("'", "''");
    }

     

  • 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.

    • PaulL's avatar
      PaulL
      Brass Contributor

      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's avatar
        PaulL
        Brass 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.

         

         

Resources