Tag Info

Hot answers tagged

5

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 ...


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 ...


5

If you want to customize the sender email address, then you cannot use SPUtility.SendEmail -- you'll have to use the System.Net.Mail framework classes. Under the covers, SPUtility calls a method named "RemoveFriendlyNameFromEmailAddress" :(


4

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; ...


3

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("", ...


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 ...


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 the tag for Utilities registration on aspx page. <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>


2

SPUtility.SendEmail() is not available in a sandbox solution. You can use the SendEmail activity in a SharePoint Designer Workflow to accomplish your task.


1

Here you go: For title: string myListTitle = SPUtility.GetLocalizedString("$Resources:core,announceList;", "core", web.Language); For Description: string myListDesc = SPUtility.GetLocalizedString("$Resources:core,announceList_Desc;", "core", web.Language);


1

(string)listitem["RichTextField"]; does return with html tags for me, turns out what I was missing was an additional header tag headers.Add("fAppendHtmlTag","True");


1

SharePoint can only work with Security Groups from Active Directory. The groups that are not working are most likely distribution groups.


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 ...


1

Create the custom Web service then use it in your application.



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