Create SharePoint event receiver for sepcifc list


When you create a new SharePoint event receiver from Visual Studio the Visual Studio asks you “What item should be the event source” – ” see image below”

For example if you choose the list template “Survey” that means your event receiver will applied in all lists from the type survey , but in the real work you need to specify a list instance which the event receiver will apply to it .

Continue reading

Understanding group by in LINQ by example


We will describe it by a full example “the full code in the end of the post for copy”

In this example we will create 2 classes , the “Task” class which has the task properties and the “TasksGroupedItem” which has 3 properties:

Task day :  it will contain the task day that we will group by

List<Task>  : it will contain list of tasks per Task Day

Then we will create a function that takes List<Task> and return List<TasksGroupedItem> , here is the code

Continue reading

Moving SharePoint documens and save it’s URL , create shorten URLs using SharePoint Document ID


The Problem


Suppose yo have this case

1-Important document uploaded to a document library in SharePoint site.

2-You sent the document URL to thousands of your customers

3-For organizing  reason the document is moved inside a folder in the document library or the document library itself is moved to other sub site.

4-The document link is failed to open by your thousands customers !

Also many problems as the above one another example you need to gave users a Shorten URL for a specific page in SharePoint.

Continue reading

Create custom error page for SharePoint event receiver


Note: you can download the full solution by Click Here

When a custom validation error occur  in SharePoint event receiver from your code and you cancel the event ,  the user will see the error in an ugly .Net default error page !

So in these steps we will view a custom error page that contains a friendly error , our example is to validate the input data in “Title” column and view an error if the “Title” is not equal “Hello” 😀

Continue reading

Fun with InfoPath and XSLT – set repeating table | section rows number by user


Note: you can download the full example by Click Here

Repeating  table and repeating  section are two controls in Microsoft InfoPath that takes a data source to bind , the number of rows for both are based on the data source rows count.

suppose you need to create a repeating  table or section rows at run time by entering the number  of rows  for repeating table by the user !

Continue reading