2

I'd like to implement an email icon on the pages of our SharePoint 2010 site collection; when the user clicks it, a Lightbox-style popup allows the user to email the current URL with a custom message to someone.

It would be great to have fields for the sender's name ("Alex" for example) and a field for the body of the message that has the page's title. This might require jQuery. Has anyone done something like this? Thanks.

2 Answers 2

2

You can develop application page and 'pop it up' by using Dialog framework on button/icon/link click event you included in masterpage (or where you need it).

In application page you add textbox for body and on PageLoad you set it's default value (current page URL):

  protected override void OnLoad(EventArgs e)
  {
     base.OnLoad(e);
     textBoxBody.Text = System.Web.HttpContext.Current.Request.Url;
  }

You also add textboxes for mail address of recipient and subject (if needed) as well as additional Send button:

 <asp:button ID="SendMail" runat="server" Text="Send" OnClick="SendUrlinMail" />

And in application page code behind:

 protected void SendUrlinMail(object sender, EventArgs e)
 {
    SPUtility.SendEmail(SPContext.Current.Web, false, false, 
             textBoxTo.text, textBoxSubject.text, textBoxBody.Text);
 }

Since you are using SPContext.Current.Web from field of your message will be current users mail (if exist) - this is something I can only verify by experience (!)

This is simplest solution I can think of. Sry - no jQuery :)

2

You can do this with a feature and a custom action.

I found something like what you need here:

https://stackoverflow.com/questions/1139873/can-i-easily-add-a-send-to-friend-or-email-this-feature-to-a-sharepoint-list

1
  • 1
    +1 because you are linking answer provided by our moderator :) but this is 2007 solution! Commented Sep 29, 2011 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.