This was a question I posted in the SharePoint Community as I was investigating around SP APIs and came to try CSOM, to see what’s there and what not.
Just at the start of utilizing CSOM and as anyone I am trying to call property “Current” for the web application instead of writing the Web Full URL which is a vvvvvv basic thing.
I looked here http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client in this Namespace: Microsoft.SharePoint.Client to find “Current” property, but nothing.
And looked for the namespace Microsoft.SharePoint.Client.Silverlight for Silverlight here http://msdn.microsoft.com/en-us/library/sharepoint/microsoft.sharepoint.client.clientcontext.aspx and it does have the “Current” property.
And view the DLL in Object Browser, there you go;
Does this means only for Silverlight web parts or what exactly?
While and of course everyone knows this in the .NET Server API it exists http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spcontext.aspx
SPList oListCur = SPContext.Current.List;
SPWeb oWeb = SPContext.Current.Web;
SPSite oSite = SPContext.Current.Site;
SPWebApplication oWebApplicationCur = SPContext.Current.Site.WebApplication;
So my question to confirm with anyone was… is “Current” property really doesn’t exists in CSOM in managed code!?
Below was the reply; I am not going to write it but rather took screen shot to read it as is; but I highlighted the important parts where he confirms it doesn’t exists in CSOM, then he explains the reason, deep dive details in the background where everyone needs to understand..
And here is the link to this discussion in SharePoint Community