Skip to main content


Showing posts from November, 2010

Email Alerts are not received...

In one of application, Email alerts are sent using SQL sp_send_dbmail stored procedure. Email alerts were working properly, but suddenly noticed email alerts are not received.

To troubleshoot the issue, first I checked the msdb.dbo.sysmail_event_log table using the below query.

SELECT log_id, event_type, log_date, description, process_id, mailitem_id, account_id, last_mod_date, last_mod_user
log_date DESC

If there is any error, you should see records with the event_type value as error.
In my case there are records with event_type value as error, and the description value for those records is same as below

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2018-02-01T10:41:27). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: Authentication required).  )

As per the error descript…

Programmatically Set Audience to a SharePoint 2010 WebPart

To provide permission to a sharepoint web part for specific SharePoint Group, we have to use AudienceManager as shown below
SPWeb currentSite = SPContext.Current.Site.RootWeb; SPSite spSite = currentSite.Site;
SPServiceContext sc = SPServiceContext.GetContext(spSite);
AudienceManager am = new AudienceManager(sc);
Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = null; mgr = currentSite.GetLimitedWebPartManager("SitePages" + "/" + page, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); foreach (System.Web.UI.WebControls.WebParts.WebPart webPart in mgr.WebParts) { if (webPart.Title == "WebPartTitle") { //Get the Existing Audience for the Web Part string audWebPart = webPart.AuthorizationFilter; //If there is no Audience for the Web Part just add it if (audWebPar…

Retrieve SharePoint 2010 Permission Levels to a ASP.NET DropDownList

Below code shows how we can get the SharePoint permission levels and assign it to a ASP.NET DropDownList (drpPermissions)
drpPermissions.AppendDataBoundItems = true;
SPWeb currentSite = SPContext.Current.Site.RootWeb;

SPRoleDefinitionCollection permissionColl = currentSite.RoleDefinitions;
foreach (SPRoleDefinition permission in permissionColl) {
drpPermissions.Items.Add(permission.Name.ToString()); drpPermissions.DataBind(); }

Issue with SharePoint Designer 2010...

While working with dashboard pages, a problem was identified.First a dashboard page was published to a SharePoint 2010 site using PerformancePoint. That page includes a SQL Server Report and a PerformancePoint Filter was applied for it. After publishing it to the SharePoint Site, the SharePoint page was opened using SharePoint Designer 2010. Then some modifications for the layout of the page was done and saved it. But when I opened the page in the browser and tried to view the report, that PerformancePoint Filter was not applied for the report.
The issue is when we save the page using SharePoint Designer, the mapping between the report and the filter was lost. To apply the filter we have to manually do the mapping.