Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace CurrentUserService
- {
- using System.Web.Script.Services;
- using System.Web.Services;
- using Microsoft.SharePoint;
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- [ScriptService]
- public class CurrentUserService : WebService
- {
- [WebMethod]
- public string GetCurrentUser(string webUrl)
- {
- using (var site = new SPSite(webUrl))
- {
- using (SPWeb web = site.OpenWeb())
- {
- return web.CurrentUser.LoginName;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement