sharepoint object modelling -


protected void btncreatelist_click(object sender, eventargs e) {     spweb currentweb = spcontext.current.web;      guid webid = currentweb.id;      guid siteid = currentweb.site.id;     response.write(siteid);      spsecurity.runwithelevatedprivileges(delegate()     {         using (spsite site = new spsite(siteid))         {             using (spweb web = site.openweb(webid))             {                 site.allowunsafeupdates = true;                 response.write("configured successfully");                }         }     });    } 

you running code outside sharepoint, or before spcontext initialized (http handler, example).


Comments

Popular posts from this blog

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -