Friday, August 22, 2014

Filter SharePoint task list view to show tasks assigned to groups I am in

If you have a SharePoint task list where the task is assigned to a SharePoint group, you may notice that the My Task list does not show tasks even if you are a member of the group of which the task is assigned.
Before:
<where><eq><fieldref name="AssignedTo"/><value type="Integer"><userid type="Integer"/></value></eq></where>
After:
<where><or><membership type="CurrentUserGroups"><fieldref name="AssignedTo"/></membership><eq><fieldref name="AssignedTo"/><value type="Integer"><userid/></value></eq></or></where>

Ghostable vs Unghostable

Ghosted Page in SharePoint

A ghosted page is a page in SharePoint website which is not stored in the database instead it reference to a file which exists in the server’s file system. These reference files are common for all the website/site collection within that SharePoint server, i.e., if you modify a reference file then that change will reflect in all the websites/site collections within that SharePoint server automatically. So we can say these reference files are used as template.

The default master page of SharePoint “default.master” is a well known example of ghosted page. “default.master” page is located in the directory "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Global". If you do some changes in the “default.master” then this change will automatically reflect in all the websites within that SharePoint server.
To create a new site in SharePoint, a site template is used. Site template contains description of all the pages, webparts within the pages, master page used, custom lists, etc. for the web site to be created. You can define a page ghostable in the “onet.xml” file of the site template.

Unghosted Page in SharePoint All the pages in a SharePoint website which are stored in the content database are referred as unghosted pages. All the unghosted pages are specific to that SharePoint website only, i.e., changes done in an unghosted pages will not reflect in other websites within that SharePoint server.

If a new website is created with a site template which contains a page defined as “unghostable” in the “onet.xml”, then that page will be stored in the content database of new website created and will not reference to the page available in the site template folder.

If a ghosted page is modified in the SharePoint designer, it will become unghosted. For example if a master page is customized in SharePoint Designer, SharePoint stores a modified version of the master page in the content database and also it breaks the reference to the “default.master” file on the “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Global“.