New answers tagged


Your code is wrong for two main reasons: You're returning an SPWeb object belonging to a closed SPSite. That's not good because closing the SPSite may actually close all child SPWeb under the hood. Meaning the caller may be using a closed SPWeb. Having a property like that lets callers assume they can call it as often as they want, e.g. like this: ...


No. The instance of your Web you create with .OpenWeb() will not be disposed, only your site will be disposed. You need to call .Dispose() on your web when you don't need it anyomore or put using around it.


String myURL = "<your site URL>/_vti_bin/owssvr.dll?Cmd=Display&List={List GUID}&XMLDATA=TRUE"; HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(myURL); myRequest.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse(); Encoding enc = ...

Top 50 recent answers are included