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 “Current” property for the web application instead of writing the Web Full URL which is a very 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 found nothing.
And I 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 mean only for Silverlight web parts or what exactly?
And in JSOM JavaScript Object model, there is a "Current" function: SP.ClientContext.get_current()
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
Example:
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 exist 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 exist 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.
Maheshkumar S Tiwari edited Revision 3. Comment: Added Tag
Balaji M Kundalam edited Revision 2. Comment: Grammatical correction.
Great article Mai Omar. Congratulations.
Thank you Hezequias Vasconcelos