Tag Info

Hot answers tagged

5

Might I suggest switching to using the System.Net.Mail.MailMessage object instead of SPUtility. SPUtility.SendEmail is a good shortcut but, as you've seen, you lose a lot of control over how the message is sent and formatted. The MailMessage object gives you that back but does require just a tiny bit more work. To answer your specific question, the ...


4

There is no possibility to send Attachments using this method. But you can use of SPAdministrationWebApplication to get the SMTP server details. Here is the sample code: //Get the Sharepoint SMTP information from the SPAdministrationWebApplication string smtpServer = SPAdministrationWebApplication.Local.OutboundMailServiceInstance .Server.Address; string ...


3

I don't know of anything in the Client Object Model that lets you do this directly, but if you don't want to have to deploy a custom web service, you could probably make a list with a simple workflow that sends an email, and then just have your web part put an entry in the list and make sure it contains the columns you'll need to build the email message in ...


3

public static bool SendEmail( SPWeb web, bool fAppendHtmlTag, bool fHtmlEncode, string to, string subject, string htmlBody) You should set the parameters: fAppendHtmlTag true to append an HTML tag to the message; otherwise, false. fHtmlEncode true to encode the message and replace characters in HTML tags with entities; ...


2

SharePoint is extremely large about the Url we pass it so even though the url isn't really to the site or to the list (but to a view) both constructor for SPSite and SPWeb.GetList accepts it: using (var site = new SPSite(url)) using (var web = site.OpenWeb()) { var list = web.GetList(url); // ID is now in list.ID; }


2

This is not an ideal solution, however if your code works when there is an SPContext, you can create a fake SPContext when it does not exist: using (var site = new SPSite("url")) { using (var web = site.OpenWeb()) { HttpContext newContext = null; if (HttpContext.Current == null) { var request = new HttpRequest("", ...


1

If the user is not in the User Information List, how would they have an associated SPUser object with a login etc.? If ResolvePrincipal() didn't return null here, wouldn't this break when you tried to access a property like you do here: SPUser user = properties.Web.EnsureUser(pi.LoginName); I think the short answer is no.


1

SpContext.CurrentWeb.Language always returns languages that is used for site creation, if you would like to change languages on your site dynamically you should use `Thread.CurrentCulture.LCID'. If you would like to get this values in .aspx file, you should create module that deploys resources files to the GlobalResources folder. See this post how to do it. ...


1

There's no such built-in functionality. In addition to two methods to achieve your goal from the similar thread provided by Falak Mahmood I can offer another one and easiest in my opinion. You can add an ASP.NET Ajax callback to your web part. Here's an example: http://ajaxzen.wordpress.com/tag/icallbackeventhandler/ Then you need only to call it from client ...



Only top voted, non community-wiki answers of a minimum length are eligible