Guest User

Untitled

a guest
Apr 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <NotificationHandlerAssembly>MySharepointHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=abcdabcdabcd</NotificationHandlerAssembly>
  2. <NotificationHandlerClassName>MySharepointHandler.MyNotifyHandler</NotificationHandlerClassName>
  3.  
  4. public class MyNotifyHandler : IAlertNotifyHandler
  5. {
  6. public bool OnNotification(SPAlertHandlerParams ahp)
  7. {
  8. using (new SPMonitoredScope("MySharepointHandler.MyNotifyHandler OnNotification"))
  9. {
  10. using (SPSite site = new SPSite(ahp.siteUrl + ahp.webUrl))
  11. {
  12. using (SPWeb web = site.OpenWeb())
  13. {
  14. string to = ahp.headers["to"];
  15.  
  16. if (to.IndexOf("@mydomain.com") < 0)
  17. {
  18. string NewBody = ahp.body;
  19. NewBody = NewBody.Replace(InternalURL, ExternalURL);
  20. SPUtility.SendEmail(web, ahp.headers, NewBody);
  21. }
  22. else
  23. {
  24. SPUtility.SendEmail(web, ahp.headers, ahp.body);
  25. }
  26. return true;
  27. }
  28. }
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment