Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

    Advertisements
  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Archive for April, 2013

SharePoint 2010 – How Alerts works?

Posted by Paul on April 16, 2013

In this article we can explore the underlying infrastructure of SharePoint Alerts. Let us analyze step by step what is happening in the background when we create an alert, alert is triggered, email is sent etc.

What are Alerts?

SharePoint provides an excellent feature which notifies the users on changes of item/library.

Uses can set alerts on:

· Library / List

· Document / Item

You can set alerts through the SharePoint user interface as shown below:

clip_image002

In order to see the above button, you need to set your Email Server in Central Administration > System Settings > Configure outgoing e-mail settings.

clip_image004

clip_image006

For receiving the emails triggered you can use an SharePoint Email Notification Tool like smtp4dev.

Create Alert

Now you are ready to create an alert & we can examine what happens in the database.

clip_image008

Open the database & you can see the following recode in ImmedSubscriptions table.

clip_image010

You can see that the ListId column is assigned with List GUID.

The table structure follows:

clip_image011

clip_image006[1]

You can see database server & name through Central Administration > Manage content databases link.

If you have created a Summary Alert (daily or weekly) you can see the record was created inside SchedSubscriptions table.

The structure of SchedSubscriptions table.

clip_image012


Timer Job

Timer Jobs are responsible for building the Alert using template & sending the Emails. We can see the timer job status through Central Administration > Monitoring > Check job status link.

clip_image014

Scrolling down, you can see the Timer Job for Immediate Alert.

clip_image016

You can see the Status of last execution there. In my case it is succeeded. Click on the link to see the settings as shown below:

clip_image018

In the above case the Timer Job is scheduled to run every 5 minutes. You can try clicking the Run Now button to trigger execution.

Alert Templates

Timer Job creates the email content of through Alert Template file. We can modify the file, but copying & modifying is recommended. We can define template in the list & library level.

The Alert template can be found in 14 hive > TEMPLATE > XML folder.

clip_image020

By default there are 2 templates – one for email & other for sms. The alerttemplates.xml file contains around 10 thousand lines.

We can change the alert template through PowerShell & STSADM commands.

References

http://bit.ly/10uiVpB

Summary

In this article we have explored the activities & tables involved while working with SharePoint Alerts.

Advertisements

Posted in SharePoint, Uncategorized | Tagged: , , | 1 Comment »

SharePoint 2010 – How Alerts works?

Posted by Paul on April 12, 2013

In this article we can explore the underlying infrastructure of SharePoint Alerts. Let us analyze step by step what is happening in the background when we create an alert, alert is triggered, email is sent etc.

What are Alerts?

SharePoint provides an excellent feature which notifies the users on changes of item/library.

Uses can set alerts on:

· Library / List

· Document / Item

You can set alerts through the SharePoint user interface as shown below:

clip_image002

In order to see the above button, you need to set your Email Server in Central Administration > System Settings > Configure outgoing e-mail settings.

clip_image004

clip_image006

For receiving the emails triggered you can use an SharePoint Email Notification Tool like smtp4dev.

Create Alert

Now you are ready to create an alert & we can examine what happens in the database.

clip_image008

Open the database & you can see the following recode in ImmedSubscriptions table.

clip_image010

You can see that the ListId column is assigned with List GUID.

The table structure follows:

clip_image011

clip_image006[1]

You can see database server & name through Central Administration > Manage content databases link.

If you have created a Summary Alert (daily or weekly) you can see the record was created inside SchedSubscriptions table.

The structure of SchedSubscriptions table.

clip_image012


Timer Job

Timer Jobs are responsible for building the Alert using template & sending the Emails. We can see the timer job status through Central Administration > Monitoring > Check job status link.

clip_image014

Scrolling down, you can see the Timer Job for Immediate Alert.

clip_image016

You can see the Status of last execution there. In my case it is succeeded. Click on the link to see the settings as shown below:

clip_image018

In the above case the Timer Job is scheduled to run every 5 minutes. You can try clicking the Run Now button to trigger execution.

Alert Templates

Timer Job creates the email content of through Alert Template file. We can modify the file, but copying & modifying is recommended. We can define template in the list & library level.

The Alert template can be found in 14 hive > TEMPLATE > XML folder.

clip_image020

By default there are 2 templates – one for email & other for sms. The alerttemplates.xml file contains around 10 thousand lines.

We can change the alert template through PowerShell & STSADM commands.

References

http://bit.ly/10uiVpB

Summary

In this article we have explored the activities & tables involved while working with SharePoint Alerts.

Posted in C# | Leave a Comment »

What is Ensure User?

Posted by Paul on April 8, 2013

In this article we can explore a new command associated with Squadron > Explorer add-in.

What is Ensure User?

Ensure User is the command that invokes EnsureUser() method for the SPWeb objects specified.

Why we need to call it?

For each new user in a web site, a user record is added to the User Info table. For new SharePoint installations, when the users login to the site first time, there will be simultaneous addition of records to the above table & might result in SQL Server Throttling error.

A wise advice for the problem is to add the user explicitly to each web site before the opening SharePoint to public.

image

Squadron is a Free SharePoint Administration tool available at www.sharepointcto.com.

image

How to perform Ensure User?

Please download & Install the latest version of Squadron. After executing it in Farm Account mode you will receive the following screen.

image

Enter the URL in the top pane & click the Explorer item from left pane. In the appearing SharePoint Web Application view, select you web item.

image

Click on the Ensure User button visible in the screen. In the appearing dialog enter the user names in the format DOMAIN\User:

image

After entering the user names, click the Execute button in the bottom to continue. You will get the following message box after operation is completed.

image

This makes sure that the user is available in the UserInfo table for the particular web site. This will prevent the possible SQL Server Errors happening in SharePoint Installations with hundreds of users.

image

You can also invoke the Ensure User within the Web Application & Site Collection level. The same button will be enabled for those commands.

For Web Application item selection:

image

For Site Collection item selection:

image

On invoking the Ensure User command, all the Web items will be enumerated in the selection dialog. You can select the web items to be processed for.

image

Following is the code that performs the EnsureUser() method invoking.

foreach (string user in UsersText.Lines)
            {   
                if (string.IsNullOrEmpty(user))
                    continue;

                foreach (int i in WebList.CheckedIndices)
                {
                    SPWeb web = WebList.Items[i] as SPWeb;
                   
                    try
                    {
                        web.EnsureUser(user.Trim());

                        SquadronContext.WriteMessage("Success: " + web.ToString() + " " + user);
                    }
                    catch (Exception ex)
                    {
                        SquadronContext.WriteMessage("Failure: " + web.ToString() + " " + user + " " + ex.ToString());
                    }
                }
            }

References

http://bit.ly/10uiVpB

Summary

In this article we have explore the Ensure User command. There are more commands associated with the Explorer Add-in of Squadron – plus, they are context sensitive based on Site / Web / List / Item types.

Posted in C#, SharePoint | Tagged: , , | Leave a Comment »

Squadron – Invalid URL Exception & Solutions

Posted by Paul on April 1, 2013

While working with the Explorer Add-in, you might receive the following error:

Invalid URL!

image

Problem

The Web Application object cannot be created using the URL specified.

Solution

You can try the following solutions:

1. Open Central Administration & Ensure the URL is correct

Open Central Administration > Manage web applications link

image

2. Execute the application from a Machine within Farm Environment & using the Farm Account.

In the Farm Machine, you an use CMD.EXE > RUNAS command to start Squadron in Farm Account context.

image

You can also try the http://localhost url within the farm environment.

 

clip_image002

Squadron is a Free SharePoint Administration tool available at http://www.sharepointcto.com.

clip_image004

Posted in C#, SharePoint | Tagged: , , , | Leave a Comment »

Squadron – Invalid URL Exception & Solutions

Posted by Paul on April 1, 2013

While working with the Explorer Add-in, you might receive the following error:

Invalid URL!

image

Problem

The Web Application object cannot be created using the URL specified.

Solution

You can try the following solutions:

1. Open Central Administration & Ensure the URL is correct

Open Central Administration > Manage web applications link

image

2. Execute the application from a Machine within Farm Environment & using the Farm Account.

In the Farm Machine, you an use CMD.EXE > RUNAS command to start Squadron in Farm Account context.

image

You can also try the http://localhost url within the farm environment.

Example: runas /user:DOMAIN\USER Application.exe (You will be prompted for Password)

 

clip_image002

Squadron is a Free SharePoint Administration tool available at http://www.sharepointcto.com.

clip_image004

Posted in C# | Leave a Comment »