Skip to main content

Harsh's Blog

Go Search
Blogs
  

Other Blogs
There are no items in this list.
Blogs > Harsh's Blog
Retrieving User Alerts via Object Model

Take a look at this screen.


This is a typical screen when a user is setting up Alerts. The SPAlert object allows easy access to the Change Type, via alert.EventType. However, the alert object model does not very intuitively allow accessing the next group of settings. Say for instance, you wish to deploy a web part that will display all the Alerts configured for the user along with providing the ability to filter out these alerts based on "what has changed".

The SPAlert object returns a PropertyBag of sorts via the SPAlert.Properties[1] method. This PropertyBag (which actually is a Microsoft.SharePoint.Utilities.SPPropertyBag [2]) contains a host of information related to the alert.

SPWeb web SPControl.GetContextWeb(Contex);
SPUser user web.CurrentUser;
SPAlertCollection alertColl web.Alerts;
foreach 
(SPAlert alert in alertColl)
{
    
if (alert.User == user)
      {
        
switch (alert.Properties["filterindex"]){
            
// multiple cases involved based on what list it was worked on
        
}
    }
}



Here's what the switch…case can use:

List Type

Filterindex options

Index

Value

Announcements

0

Anything changes

 

1

Someone else changes an announcement

 

2

Someone else changes an announcement created by me

 

3

Someone else changes an announcement last modified by me

 

4

An announcement with an expiration date is added or changed

     

Calendar

0

Anything changes

 

1

Someone else changes an event

 

2

Someone else changes an event created by me

 

3

Someone else changes an event last modified by me

 

4

The time or location of an event changes

     

Links

0

Anything changes

 

1

Someone else changes a link

 

2

Someone else changes a link created by me

 

3

Someone else changes a link last modified by me

     

Tasks

0

Anything changes

 

1

A task is assigned to me

 

2

A task becomes complete

 

3

A high priority task changes

 

4

Someone else changes a task assigned to me

 

5

Someone else changes a task

 

6

Someone else changes a task created by me

 

7

Someone else changes a task last modified by me

 

8

Someone changes an item that appears in a view*

     

Discussion Board

0

Anything changes

 

1

Someone else changes a post

 

2

Someone else changes a post created by me

 

3

Someone else changes a post last modified by me

     

Form Library

0

Anything changes

 

1

Someone else changes a document

 

2

Someone else changes a document created by me

 

3

Someone else changes a document last modified by me

 

4

Someone else changes an item that appears in a view*

     

Wiki Page Library

0

Anything changes

 

1

Someone else changes a wiki page

 

2

Someone else changes a wiki page created by me

 

3

Someone else changes a wiki page last modified by me

 

4

Someone else changes an item that appears in a view*

     

Picture Library

0

Anything changes

 

1

Someone else changes a picture

 

2

Someone else changes a picture created by me

 

3

Someone else changes a picture last modified by me

     

 

SharePoint 2007 Maximum Limitations

Following is a list of names and other parameters with the maximum allowable size on each.

 

Entity         
Max permissible size
Site Name    
128 characters
Site URL          
255 characters
Display name
128 characters
Connection string
384 characters
Email address
128 characters
Version numbers
064 characters
Virtual Server Friendly Name
064 characters
SQL Database Name 
123 characters
SQL Database Column
128 characters
SQL Database Table Name 128 characters
SQL Role Name 128 characters
Server Name 128 characters
Windows User Name 300 characters
Windows Password 300 characters
Dependencies per object 032 objects
Zone enumeration value  004 zones
Default SQL command timeout 300 seconds
Number of simultaneous
workflows that can be run
015

 If during your course of using the product, you inadvertently cross these limits, then you would end up with errors. These are hard limits.

 

~harsh

 

 

 

 ‭(Hidden)‬ Admin Links