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 ------------------------------------------------------------------------------...
-
SharePoint 2010 brings a few new master pages that you may want to know about. There are additional master pages to accommodate both the ol...
-
Sharepoint Online Management Shell ------------------------------------------------------------------------------------------------------...
No comments:
Post a Comment