0

This question already has an answer here:

I'm little bit confused about JS's COM in SharePoint 2013 and disposing ClientContext object. As far as I can see from earlier versions of SP (2010 mainly) you had to dispose ClientContext and according to MSDN there is a method on this object called Dispose. However, when I'm trying to dispose ClientContext object, I got error that object doesn't have this method. Also, IntelliSense is not exposing it.

The question is - in SharePoint 2013 in client object model (used in JavaScript), do I have to dispose ClientContext (either initialized as new SP.ClientContext(url) or SP.ClientContext.get_current() ), and if I do, how and when?

marked as duplicate by Robert Lindgren Feb 17 '14 at 9:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You had to dispose the JavaScript object in 2010? Are you sure? Got any link to that? However Microsoft.SharePoint.Client.ClientRuntimeContext extends IDisposable and you should dispose this, but only in C#, I imagine this will dispose off some TCP clients – eirikb Feb 17 '14 at 9:13
  • @eirikb I've never worked with SP2010, but I got feeling you had to Dispose ClientContext from an article or two which I read. I might, indeed, be wrong. – StupidOne Feb 17 '14 at 9:23
  • Have you seen sharepoint.stackexchange.com/a/62902/627 ? This question might be a duplicate, as I believe it should be the same for 2013. – eirikb Feb 17 '14 at 9:24
  • @eirikb (and MdMazzoti) - yep, that Q&As are what I was looking for. Thanks! – StupidOne Feb 17 '14 at 9:27