Friday 12 October 2012

CAML Query Documents from SharePoint Library by Title


I recently faced one issue writing a CAML Query To access documents from SharePoint library By Title
The Query I Used Is As Below
@"<Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>SampleData</Value></Eq></Where></Query>";

I was Unable to get the perfect data.

When digging into the matter I Found that “Name” Column is not referring to the “Title” Column.
The internal name is “FileLeafRef”
I was able to get the data by changing Title To “FileLeafRef”.
The below query is working.
@"<Query><Where><Eq><FieldRef Name='FileLeafRef'/><Value Type='Text'> SampleData </Value></Eq></Where></Query>";

Wednesday 10 October 2012

Customize Site Settings Page In SharePoint 2010


When building complex SharePoint applications we often require adding some custom administrative pages to offer various application settings. This can be done by extending site settings page (/_layouts/settings.aspx) with custom sections and links.

Steps To  Add Custom Sections and Links in Site Settings Page.

Create an Empty SharePoint project and add an Empty Element to it
Write the below code in it inside Elements tag.

<CustomActionGroup
Id="MyCustomGroup"
Title="My Custom Group"
Description="This is my custom group"
ImageUrl="_layouts/images/SiteSettings_SiteCollectionAdmin_48x48.png"
Location="Microsoft.SharePoint.SiteSettings"
RequiredAdmin="Delegated"
Sequence="1" />
<CustomAction
Id="MyFirstAdminAction"
Title="My First Admin Action"
Description="This is a short description of my first admin action."
Location="Microsoft.SharePoint.SiteSettings"
GroupId="MyCustomGroup"
Sequence="100" >
<UrlAction Url="~site/_layouts/MyAdminPage.aspx" />
</CustomAction>


 
Deploy the Solution and you can see “My Custom Group”  in Site Settings Page.