Skip to main content

Posts

Showing posts from April, 2024

How to handle special characters in REST API SharePoint

If you're wondering about enabling special character usage with SharePoint REST API or filtering SharePoint Search REST queries involving special characters, this blog is tailored to address your concerns.  How to allow special characters using SharePoint REST API? SharePoint Search REST query filter with special characters. Special characters can indeed pose challenges when working with APIs like SharePoint REST API or libraries like PnP JS. These characters, if not handled properly, can cause issues such as code breaking or unexpected behavior. Let's see how we can handle this: Special characters in URLs need to be properly encoded to ensure they are transmitted correctly. In JavaScript, you can use the encodeURIComponent() function to encode special characters before making requests to the REST API or using them in PnP JS. For instance, if you possess a 'filterText' variable intended for passing to a function, it's advisable to encode it initially to manage speci...