Pages

Sunday, November 29, 2015

CAML Query with Lists in SharePoint 2013


Single Line of Text
<Where><Eq><FieldRef Name="Name" /><Value Type="Text">EmployeeName</Value></Eq></Where>
__________________________________________________________________

Multiple Lines of Text
<Where><Eq><FieldRef Name="Address" /><Value Type="Text">EmployeeAddress</Value></Eq></Where>
__________________________________________________________________

Choice
<Where><Contains><FieldRef Name='Province'/><Value Type='Choice'>East</Value></Contains></Where>
__________________________________________________________________

Number
<Where><Contains><FieldRef Name='Quantity'/><Value Type='Number'>0</Value></Contains></Where>
__________________________________________________________________

Date and Time
<Where><Eq><FieldRef Name="CurrentDate" /><Value Type="DateTime" IncludeTimeValue='FALSE'>2001-01-01</Value></Eq></Where>
__________________________________________________________________

Lookup By Lookup Name
<Query><Where><Eq><FieldRef Name="State" /><Value Type="Lookup">Arizona</Value></Eq></Where></Query>

Lookup By Lookup Id
<Query><Where><Eq><FieldRef Name="State" LookupId="TRUE" /><Value Type="Lookup">4</Value></Eq></Where></Query>
__________________________________________________________________

Yes/No
<Where><Eq><FieldRef Name="Active" /><Value Type="Boolean">1</Value></Eq></Where>
__________________________________________________________________

Person or Group By SPUser.Name
<Query><Where><Eq><FieldRef Name="Author" />Value Type="Text">Josh McCarty</Value></Eq></Where></Query>

Person or Group By SPUser.ID
<Query><Where><Eq><FieldRef Name="Author" LookupId="TRUE" /><Value Type="Integer"><UserID /></Value></Eq></Where></Query>
__________________________________________________________________

Hyperlink or Picture
<Where><Contains><FieldRef Name='URL'/><Value Type='URL'>http://facebook.com</Value></Contains></Where>
__________________________________________________________________

Calculated
<Where><Eq><FieldRef Name='Status' /><Value Type='Calculated'>Completed</Value></Eq></Where>
__________________________________________________________________

CAML Operators
<Eq> – Equals
<Neq> – Not Equals
<Gt> – Greater than
<Geq> – Greater than or Equals
<Lt> – Less Than
<Leq> – Less Than or Equals
<sNull> – Is Null (Is Empty)
<BeginsWith> – Begins with a string
<Contains> – Contains a string
__________________________________________________________________

ORDER BY
<OrderBy> <FieldRef Name="[Field_Name]" Ascending="True" /></OrderBy>

Ex: <Where><Eq><FieldRef Name="Name" /><Value Type="Text">EmployeeName</Value></Eq></Where><OrderBy> <FieldRef Name="Name" Ascending="True" /></OrderBy>

The default value of Ascending is TRUE (By Default Order is in Descending)

Sunday, November 15, 2015

Common SharePoint URLs

Sometimes you want to jump right to a specific system list, page or go to the edit mode in a SharePoint site. The following is a list of SharePoint URLs to get to commonly used administrative functions on a SharePoint site. The majority of the URLs require administrator permissions on the site and a few require administrator permissions on the SharePoint server.

(For SharePoint 2013/ 2016 you might want to add "15", "16" respectively after "/_layouts/")

Site settings page:
/_layouts/settings.aspx

View all site content page (Site content):
/_layouts/viewlsts.aspx

Site content and structure page:
/_layouts/sitemanager.aspx

Manage site collection features - CASE SENSITIVE
/_layouts/ManageFeatures.aspx?Scope=Site

Manage site features:
/_layouts/ManageFeatures.aspx

Sign in as a different user:
/_layouts/closeConnection.aspx?loginasanotheruser=true

Welcome Page (Default page settings):
/_layouts/AreaWelcomePage.aspx

User Information List:
 _catalogs/users
_catalogs/users/simple.aspx

Change Site Master Page:
/_layouts/ChangeSiteMasterPage.aspx

Page Layouts and Site Templates:
/_Layouts/AreaTemplateSettings.aspx

Master Page’s library:
/_catalogs/master page/Forms/AllItems.aspx

User Information list per Site Collection:
/_catalogs/users/simple.aspx 
/_catalogs/users/detail.aspx (also see)
/_layouts/userdisp.aspx?id={UserID}&Force=True

Login using Windows credentials:
/_windows/default.aspx

Web Part Maintenance Page:
? Contents=1

Also see:

Saturday, November 7, 2015

Problem with using [Today] and [Me] in Calculated Columns

When you working with calculated columns you may have already figured out that you cannot use [Me] and [Today] functions in calculated column formulas and have seen “Calculated columns cannot contain volatile functions like Today and Me” error.

And you may have also seen a well-known tricky solution in some blogposts and sites like creating two columns named “Today” and “Me” to use in calculated column formulas. 

This may actually tricky but the worst case is that it has critical limitations and also it is not officially supported by Microsoft.

Regards to Christope...

Christope have already documented back this thing and have given two good solutions for this useless tricky thing with needful explanations.

Refer this links to see how he has achieved this posts’ title with overcome of limitations exist with [Today] and [Me] trick.