views:

35

answers:

1

i tried to get the current web using client object model. i am not able to get that..please guide me to find it

I tried with the below code its not working..

ClientContext context = new ClientContext(ApplicationContext.Current.Url);
A: 

Current Web works only for the Server Side code that executes inside SharePoint context. When in ClientContext you can get the web you want using the below code, it gives you the web that is refered by the URL you mentioned in the ClientContext Class.

            ClientContext context = new ClientContext(ApplicationContext.Current.Url);
            var web = site.Web;
            site.Load(web);
Kusek
Applicationcontex not working,I have to add any assembly refferance or what??
Ayyappan.Anbalagan