Hi SharePoint Community,
My question either simple or wired but it is not difficult; there is nothing difficult about it.
Basically I was investigating the APIs in SharePoint 2013.. whats there and what not..
Just at the start of utilizing CSOM and as anyone I am trying to call property “Current” for web application instead of writing the Web Full URL .. which is a v basic thing.
I am looking here http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.clientcontext.current.aspx and look at the Namespace: Microsoft.SharePoint.Client but the DLL is for Silverlight!!! Assembly: Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll)
Does this means only for Silverlight web parts or what exactly?
While and of course everyone knows this [assuming so] 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; My question is ... is "Current" property really doesn't exists in CSOM in managed code!? Regards, Mai Omar Desouki
Well, there is no “Current” in the CSOM as it works very different to the server OM.
Even with JSOM, SP.ClientContext.get_current() doesn’t mean you have “a current context”. Instead, a new SPContext gets created with the “current page URL” which reflects the current SPSite/SPWeb.
Next step is all about SPContext.Current in the server side OM. It related to the asp.net pipeline, IIS and asp.net context and execution flow, and yea.. there is SPCOntext.Current. But only within w3wp.exe process, on the pages, web part or other web-related stuff. We don’t have SPContext.Current within let say timer jobs, it is not a we related context.
Now, client object model. Silverlight property Current might woek on the web pager within SharePoint. It just means SharePoint API makes additional effort and initializes SilverLight related stuff with the current page URL.
As for the client applications, desktop or other CSOM based apps – huh, no way. That’s how it works, and how it is supposed to work. actually.
Hope it makes sense and helps a little to sort these things out.