Getting Current WebURL
1)In Webparts.
SPWeb web = new SPSite(SPContext.Current.Web.Url.ToString()).OpenWeb();
2)In Event receivers.(Properties)
string mysite = properties.WebUrl;
SPWeb web = new SPSite(mysite).OpenWeb();
Getting Current User
1)In webparts
string user = SPContext.Current.Web.CurrentUser.ToString();
2)In EventReceivers
string user=properties.ListItem.Web.CurrentUser.ToString();
Subscribe to:
Post Comments (Atom)
Content Editor Webpart not showing up in SharePoint Online ------------------------------------------------------------------------------...
-
Content Editor Webpart not showing up in SharePoint Online ------------------------------------------------------------------------------...
-
Regarding “SharePoint Foundation” and “SharePoint Server 2010”, the important thing to understand is that SharePoint Foundation is the found...
-
Ribbon missing in Share point online Pages to add custom web part : --------------------------------------------------------------------...
No comments:
Post a Comment