I am trying to get the clientcontext of the subsite that I create

In the below code I check if the site exits and return the url if its existing

            var web = context.Web;
            context.Load(web, w => w.Webs);
            var subWeb = (from w in web.Webs where w.Title == webTitle select w).SingleOrDefault();
            if (subWeb == null)
                return false;
            Url = subWeb.Url;

This works for cases where the website url is not containing special characters like é

When it has characters like that I get the below error

Cannot contact site at the specified URL https://abc.sharepoint.com/sites/abc/xxx-BeaujonImieMol�culaire.

I doubt that part of the URL as its not the same special character

How should I handle this? How should characters like � be handled or converted to actual character?

  • How are you passing the webTitle parameter ? Looks like an issue there Oct 9, 2017 at 11:27
  • I'm reading it from excel, and the parameter also contains � instead of the actual character Oct 9, 2017 at 11:34
  • hmm, fix it there. Code looks fine Oct 9, 2017 at 11:34

1 Answer 1


I had the same issue once. I solved it by copying the text into notepad and encode it to UTF-8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.